From 6a9a058644a7b0df4ece26d32ab4442174bfa098 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Tue, 26 Jul 2011 01:56:33 +0000 Subject: [PATCH] More of the bulky C++ pedantry worked through without actually taking advantage of C++ yet. --- gpsbabel/GPSBabel.pro | 7 +- gpsbabel/alan.c | 146 +++---- gpsbabel/an1.c | 226 +++++------ gpsbabel/an1sym.h | 6 +- gpsbabel/arcdist.c | 34 +- gpsbabel/avltree.c | 144 +++---- gpsbabel/avltree.h | 38 +- gpsbabel/axim_gpb.c | 48 +-- gpsbabel/bcr.c | 88 ++--- gpsbabel/brauniger_iq.c | 10 +- gpsbabel/bushnell.c | 30 +- gpsbabel/bushnell_trl.c | 16 +- gpsbabel/cet.c | 90 ++--- gpsbabel/cet.h | 40 +- gpsbabel/cet_util.c | 240 ++++++------ gpsbabel/cet_util.h | 48 +-- gpsbabel/cetus.c | 94 ++--- gpsbabel/coastexp.c | 196 +++++----- gpsbabel/compegps.c | 84 ++-- gpsbabel/copilot.c | 56 +-- gpsbabel/coto.c | 64 +-- gpsbabel/cst.c | 42 +- gpsbabel/csv_util.c | 232 +++++------ gpsbabel/csv_util.h | 58 +-- gpsbabel/defs.h | 474 +++++++++++------------ gpsbabel/delbin.c | 108 +++--- gpsbabel/delgpl.c | 16 +- gpsbabel/destinator.c | 70 ++-- gpsbabel/dg-100.c | 60 +-- gpsbabel/discard.c | 28 +- gpsbabel/dmtlog.c | 120 +++--- gpsbabel/duplicate.c | 46 +-- gpsbabel/easygps.c | 14 +- gpsbabel/enigma.c | 18 +- gpsbabel/exif.c | 296 +++++++------- gpsbabel/explorist_ini.c | 26 +- gpsbabel/explorist_ini.h | 4 +- gpsbabel/fatal.c | 4 +- gpsbabel/filter_skeleton.c | 2 +- gpsbabel/filter_vecs.c | 58 +-- gpsbabel/filterdefs.h | 10 +- gpsbabel/format_skeleton.c | 4 +- gpsbabel/formspec.c | 20 +- gpsbabel/g7towin.c | 46 +-- gpsbabel/garmin.c | 128 +++--- gpsbabel/garmin_device_xml.c | 35 +- gpsbabel/garmin_device_xml.h | 238 ++++++------ gpsbabel/garmin_fs.c | 60 +-- gpsbabel/garmin_fs.h | 50 +-- gpsbabel/garmin_gpi.c | 176 ++++----- gpsbabel/garmin_tables.c | 88 ++--- gpsbabel/garmin_tables.h | 34 +- gpsbabel/garmin_txt.c | 192 ++++----- gpsbabel/garmin_xt.c | 26 +- gpsbabel/gbfile.c | 190 ++++----- gpsbabel/gbfile.h | 110 +++--- gpsbabel/gbser.c | 20 +- gpsbabel/gbser.h | 36 +- gpsbabel/gbser_posix.c | 54 +-- gpsbabel/gbser_private.h | 6 +- gpsbabel/gbser_win.c | 60 +-- gpsbabel/gcdb.c | 30 +- gpsbabel/gdb.c | 216 +++++------ gpsbabel/geo.c | 48 +-- gpsbabel/geoniche.c | 82 ++-- gpsbabel/ggv_log.c | 26 +- gpsbabel/ggv_ovl.c | 48 +-- gpsbabel/glogbook.c | 36 +- gpsbabel/gnav_trl.c | 22 +- gpsbabel/google.c | 86 ++--- gpsbabel/gopal.c | 42 +- gpsbabel/gpilots.c | 44 +-- gpsbabel/gpspilot.c | 32 +- gpsbabel/gpssim.c | 24 +- gpsbabel/gpsutil.c | 18 +- gpsbabel/gpx.c | 278 +++++++------- gpsbabel/grtcirc.c | 4 +- gpsbabel/grtcirc.h | 2 +- gpsbabel/gtm.c | 68 ++-- gpsbabel/gtrnctr.c | 76 ++-- gpsbabel/height.c | 12 +- gpsbabel/hiketech.c | 56 +-- gpsbabel/holux.c | 72 ++-- gpsbabel/hsa_ndv.c | 54 +-- gpsbabel/html.c | 54 +-- gpsbabel/humminbird.c | 72 ++-- gpsbabel/igc.c | 140 +++---- gpsbabel/ignrando.c | 38 +- gpsbabel/igo8.c | 22 +- gpsbabel/ik3d.c | 26 +- gpsbabel/inifile.c | 94 ++--- gpsbabel/inifile.h | 12 +- gpsbabel/interpolate.c | 24 +- gpsbabel/itracku.c | 50 +-- gpsbabel/jeeps/garminusb.h | 12 +- gpsbabel/jeeps/gps.h | 432 ++++++++++----------- gpsbabel/jeeps/gpsapp.c | 684 ++++++++++++++++----------------- gpsbabel/jeeps/gpsapp.h | 150 ++++---- gpsbabel/jeeps/gpscom.c | 102 ++--- gpsbabel/jeeps/gpscom.h | 54 +-- gpsbabel/jeeps/gpsdatum.h | 8 +- gpsbabel/jeeps/gpsdevice.c | 22 +- gpsbabel/jeeps/gpsdevice.h | 34 +- gpsbabel/jeeps/gpsdevice_usb.c | 6 +- gpsbabel/jeeps/gpsfmt.c | 142 +++---- gpsbabel/jeeps/gpsfmt.h | 16 +- gpsbabel/jeeps/gpsinput.c | 272 ++++++------- gpsbabel/jeeps/gpsinput.h | 10 +- gpsbabel/jeeps/gpslibusb.c | 66 ++-- gpsbabel/jeeps/gpsmath.c | 158 ++++---- gpsbabel/jeeps/gpsmath.h | 128 +++--- gpsbabel/jeeps/gpsmem.c | 40 +- gpsbabel/jeeps/gpsmem.h | 18 +- gpsbabel/jeeps/gpsproj.c | 152 ++++---- gpsbabel/jeeps/gpsproj.h | 152 ++++---- gpsbabel/jeeps/gpsprot.c | 2 +- gpsbabel/jeeps/gpsread.c | 10 +- gpsbabel/jeeps/gpsread.h | 4 +- gpsbabel/jeeps/gpsrqst.c | 12 +- gpsbabel/jeeps/gpsrqst.h | 4 +- gpsbabel/jeeps/gpssend.c | 24 +- gpsbabel/jeeps/gpssend.h | 6 +- gpsbabel/jeeps/gpsserial.c | 82 ++-- gpsbabel/jeeps/gpsserial.h | 20 +- gpsbabel/jeeps/gpsusbcommon.c | 26 +- gpsbabel/jeeps/gpsusbcommon.h | 8 +- gpsbabel/jeeps/gpsusbint.h | 6 +- gpsbabel/jeeps/gpsusbread.c | 2 +- gpsbabel/jeeps/gpsusbsend.c | 2 +- gpsbabel/jeeps/gpsusbstub.c | 2 +- gpsbabel/jeeps/gpsusbwin.c | 38 +- gpsbabel/jeeps/gpsutil.c | 70 ++-- gpsbabel/jeeps/gpsutil.h | 32 +- gpsbabel/jeeps/main.c | 6 +- gpsbabel/jogmap.c | 16 +- gpsbabel/jtr.c | 28 +- gpsbabel/kml.c | 230 +++++------ gpsbabel/lmx.c | 50 +-- gpsbabel/lowranceusr.c | 74 ++-- gpsbabel/mag_pdb.c | 26 +- gpsbabel/magellan.h | 18 +- gpsbabel/maggeo.c | 48 +-- gpsbabel/magnav.c | 38 +- gpsbabel/magproto.c | 228 +++++------ gpsbabel/main.c | 62 +-- gpsbabel/mapasia.c | 34 +- gpsbabel/mapopolis.c | 46 +-- gpsbabel/mapsend.c | 46 +-- gpsbabel/mapsource.c | 172 ++++----- gpsbabel/mkicondoc.c | 12 +- gpsbabel/mkshort.c | 106 ++--- gpsbabel/mmo.c | 226 +++++------ gpsbabel/msroute.c | 96 ++--- gpsbabel/mtk_logger.c | 84 ++-- gpsbabel/navicache.c | 32 +- gpsbabel/naviguide.c | 28 +- gpsbabel/navilink.c | 204 +++++----- gpsbabel/navilink.h | 6 +- gpsbabel/navitel.c | 18 +- gpsbabel/netstumbler.c | 44 +-- gpsbabel/nmea.c | 144 +++---- gpsbabel/nmn4.c | 42 +- gpsbabel/nukedata.c | 2 +- gpsbabel/osm.c | 144 +++---- gpsbabel/overlay.c | 94 ++--- gpsbabel/ozi.c | 4 +- gpsbabel/pdbfile.h | 28 +- gpsbabel/pocketfms_bc.c | 4 +- gpsbabel/pocketfms_fp.c | 2 +- gpsbabel/pocketfms_wp.c | 2 +- gpsbabel/queue.h | 10 +- gpsbabel/random.c | 4 +- gpsbabel/raymarine.c | 8 +- gpsbabel/saroute.c | 8 +- gpsbabel/sbn.c | 2 +- gpsbabel/session.h | 10 +- gpsbabel/skytraq.c | 4 +- gpsbabel/strptime.h | 2 +- gpsbabel/tef_xml.c | 2 +- gpsbabel/teletype.c | 4 +- gpsbabel/tomtom.c | 14 +- gpsbabel/tpo.c | 42 +- gpsbabel/vidaone.c | 2 +- gpsbabel/vitosmt.c | 8 +- gpsbabel/wbt-200.c | 52 +-- gpsbabel/wfff_xml.c | 2 +- gpsbabel/xmlgeneric.h | 50 +-- gpsbabel/xol.c | 6 +- gpsbabel/yahoo.c | 2 +- 189 files changed, 6279 insertions(+), 6277 deletions(-) diff --git a/gpsbabel/GPSBabel.pro b/gpsbabel/GPSBabel.pro index f8183cc91..9d2e92546 100644 --- a/gpsbabel/GPSBabel.pro +++ b/gpsbabel/GPSBabel.pro @@ -6,11 +6,11 @@ CONFIG -= app_bundle TEMPLATE = app -XMINIMAL_FMTS = magproto.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \ +MINIMAL_FMTS = magproto.cc explorist_ini.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \ garmin_device_xml.cc garmin_tables.cc internal_styles.cc nmea.cc \ kml.cc wbt-200.cc -XALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \ +ALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \ gpspilot.cc magnav.cc skytraq.cc \ psp.cc holux.cc tmpro.cc tpg.cc tpo.cc \ xcsv.cc gcdb.cc tiger.cc easygps.cc quovadis.cc \ @@ -29,6 +29,7 @@ XALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \ pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \ vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \ subrip.cc garmin_xt.cc explorist_ini.cc \ + ALL_FMTS=$$MINIMAL_FMTS FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \ reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \ @@ -64,6 +65,7 @@ macx|linux { INCLUDEPATH += jeeps LIBS += -lexpat } + win32 { SOURCES += gbser_win32.cc jeeps/gpsusbwin.c } @@ -79,7 +81,6 @@ macx { mac/libusb/descriptors.c \ mac/libusb/error.c \ mac/libusb/usb.c - } SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS diff --git a/gpsbabel/alan.c b/gpsbabel/alan.c index 85a0ba47c..0eea38e6d 100644 --- a/gpsbabel/alan.c +++ b/gpsbabel/alan.c @@ -176,7 +176,7 @@ enum { /**************************************************************************/ -static gbfile *fin = NULL, *fout = NULL; +static gbfile* fin = NULL, *fout = NULL; struct wprdata WPR; struct trldata TRL; @@ -196,43 +196,43 @@ static arglist_t trl_args[] = { }; /**************************************************************************/ - +// FIXME: Why is this code doing its own byte order conversion? static unsigned int byte_order(void) { unsigned long test = BYTEORDER_TEST; - unsigned char *ptr; + unsigned char* ptr; unsigned int order; - ptr = (unsigned char *)(&test); + ptr = (unsigned char*)(&test); order = (ptr[0] << 12) | (ptr[1] << 8) | (ptr[2] << 4) | ptr[3]; return order; } -static void sw_bytes(void *word) +static void sw_bytes(void* word) { - gbuint8 *p = word; - gbuint16 *r = word; + gbuint8* p = (gbuint8*) word; + gbuint16* r = (gbuint16*) word; *r = (gbuint16)(p[1] << 8 | p[0]); } -static void sw_words(void *dword) +static void sw_words(void* dword) { - gbuint16 *p = dword; - gbuint32 *r = dword; + gbuint16* p = (gbuint16*) dword; + gbuint32* r = (gbuint32*) dword; *r = (gbuint32)(p[0] << 16 | p[1]); } -static void rev_bytes(void *dword) +static void rev_bytes(void* dword) { - gbuint8 *p = dword; - gbuint32 *r = dword; + gbuint8* p = (gbuint8*) dword; + gbuint32* r = (gbuint32*) dword; *r = (gbuint32)(p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0]); } -static void swap_wpthdr(struct wpthdr *wpthdr, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_wpthdr(struct wpthdr* wpthdr, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { int i; @@ -248,8 +248,8 @@ static void swap_wpthdr(struct wpthdr *wpthdr, } } -static void swap_wpt(struct wpt *wpt, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_wpt(struct wpt* wpt, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { if (swap16_func != NULL) { swap16_func(&wpt->usecount); @@ -262,8 +262,8 @@ static void swap_wpt(struct wpt *wpt, } } -static void swap_rtehdr(struct rtehdr *rtehdr, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_rtehdr(struct rtehdr* rtehdr, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { int i; @@ -280,8 +280,8 @@ static void swap_rtehdr(struct rtehdr *rtehdr, } } -static void swap_rte(struct rte *rte, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_rte(struct rte* rte, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { int i; @@ -298,10 +298,10 @@ static void swap_rte(struct rte *rte, } } -static void wpr_swap(struct wprdata *wprdata) +static void wpr_swap(struct wprdata* wprdata) { - void (*swap16_func)(void *); - void (*swap32_func)(void *); + void (*swap16_func)(void*); + void (*swap32_func)(void*); int i; switch (byte_order()) { @@ -334,8 +334,8 @@ static void wpr_swap(struct wprdata *wprdata) } } -static void swap_trkhdr(struct trkhdr *trkhdr, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_trkhdr(struct trkhdr* trkhdr, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { if (swap16_func != NULL) { swap16_func(&(trkhdr->totalpt)); @@ -348,8 +348,8 @@ static void swap_trkhdr(struct trkhdr *trkhdr, } } -static void swap_loghdr(struct loghdr *loghdr, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_loghdr(struct loghdr* loghdr, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { int i; @@ -367,8 +367,8 @@ static void swap_loghdr(struct loghdr *loghdr, } } -static void swap_trklog(struct trklog *trklog, - void (*swap16_func)(void *), void (*swap32_func)(void *)) +static void swap_trklog(struct trklog* trklog, + void (*swap16_func)(void*), void (*swap32_func)(void*)) { int i; @@ -386,10 +386,10 @@ static void swap_trklog(struct trklog *trklog, } } -static void trl_swap(struct trldata *trldata) +static void trl_swap(struct trldata* trldata) { - void (*swap16_func)(void *); - void (*swap32_func)(void *); + void (*swap16_func)(void*); + void (*swap32_func)(void*); int i; switch (byte_order()) { @@ -421,7 +421,7 @@ static void trl_swap(struct trldata *trldata) /**************************************************************************/ -static void str2lab(char *dest, char *src, int len, char *fmt, int n) +static void str2lab(char* dest, char* src, int len, char* fmt, int n) { int i,j; @@ -442,9 +442,9 @@ static void str2lab(char *dest, char *src, int len, char *fmt, int n) } } -static void pack_time(time_t t, gbint32 *date, gbint32 *time) +static void pack_time(time_t t, gbint32* date, gbint32* time) { - struct tm *tm; + struct tm* tm; tm = gmtime(&t); *date = tm->tm_mday | ((tm->tm_mon+1)<<8) | ((tm->tm_year+1900)<<16); @@ -486,12 +486,12 @@ static time_t unpack_time(gbint32 date, gbint32 time) /**************************************************************************/ -static waypoint * get_wpt(struct wprdata *wprdata, unsigned n) +static waypoint* get_wpt(struct wprdata* wprdata, unsigned n) { - struct wpthdr *wpthdr; - struct wpt *wpt; + struct wpthdr* wpthdr; + struct wpt* wpt; int j, idx; - waypoint *WP; + waypoint* WP; wpthdr = &(wprdata->wpthdr); idx = wpthdr->idx[n]; @@ -521,11 +521,11 @@ static waypoint * get_wpt(struct wprdata *wprdata, unsigned n) static void wpr_read(void) { struct wprdata wprdata; - struct rtehdr *rtehdr; - struct rte *rte; + struct rtehdr* rtehdr; + struct rte* rte; int i, j, idx; - waypoint *WP; - route_head *RT; + waypoint* WP; + route_head* RT; if (gbfread(&wprdata, sizeof(struct wprdata), 1, fin) != 1) { fatal(MYNAME ": Read error on %s\n", fin->name); @@ -579,10 +579,10 @@ static void wpr_read(void) static void trl_read(void) { struct trldata trldata; - struct trkhdr *trkhdr; - struct trklog *trklog; - waypoint *WP; - route_head *TL; + struct trkhdr* trkhdr; + struct trklog* trklog; + waypoint* WP; + route_head* TL; int i, j; for (i=0; iwpthdr); @@ -718,16 +718,16 @@ static int add_wpt(struct wprdata *wprdata, const waypoint *WP,int isroute) return hdr_idx; } -static void wpr_waypoint(const waypoint *WP) +static void wpr_waypoint(const waypoint* WP) { add_wpt(&WPR, WP, 0); } -static void wpr_route_hdr(const route_head *RT) +static void wpr_route_hdr(const route_head* RT) { - struct rtehdr *rtehdr; + struct rtehdr* rtehdr; int hdr_idx, rte_idx; - struct rte *rte; + struct rte* rte; int i; rtehdr = &(WPR.rtehdr); @@ -756,9 +756,9 @@ static void wpr_route_hdr(const route_head *RT) /* rtehdr->rteno = rte_idx; */ } -static void wpr_route_wpt(const waypoint *WP) +static void wpr_route_wpt(const waypoint* WP) { - struct rte *rte; + struct rte* rte; int wpt_idx; rte = &(WPR.rte[WPR.rtehdr.num -1]); @@ -772,7 +772,7 @@ static void wpr_route_wpt(const waypoint *WP) rte->wptnum ++; } -static void wpr_route_trl(const route_head *RT) +static void wpr_route_trl(const route_head* RT) { /* should we do some final sanity checks? */ } @@ -808,9 +808,9 @@ static void wpr_write(void) /**************************************************************************/ -static void trl_track_hdr(const route_head *TL) +static void trl_track_hdr(const route_head* TL) { - struct trkhdr *trkhdr; + struct trkhdr* trkhdr; int idx, l; trkhdr = TRL.loghdr.trkhdr; @@ -845,10 +845,10 @@ static void trl_track_hdr(const route_head *TL) TRL.loghdr.num = idx; } -static void trl_track_wpt(const waypoint *WP) +static void trl_track_wpt(const waypoint* WP) { - struct trklog *trklog; - struct trkhdr *trkhdr; + struct trklog* trklog; + struct trkhdr* trkhdr; int trk_idx, log_idx; trk_idx = TRL.loghdr.num; @@ -873,9 +873,9 @@ static void trl_track_wpt(const waypoint *WP) trkhdr->next = trkhdr->totalpt; } -static void trl_track_tlr(const route_head *TL) +static void trl_track_tlr(const route_head* TL) { - struct trkhdr *trkhdr; + struct trkhdr* trkhdr; int trk_idx; trk_idx = TRL.loghdr.num; @@ -890,8 +890,8 @@ static void trl_track_tlr(const route_head *TL) static void trl_write(void) { - struct trkhdr *trkhdr; - void *buf; + struct trkhdr* trkhdr; + void* buf; int i; size_t fill; @@ -946,7 +946,7 @@ static void trl_write(void) /**************************************************************************/ -static void alan_rd_init(const char *fname) +static void alan_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); } @@ -958,7 +958,7 @@ static void alan_rd_deinit(void) } -static void alan_wr_init(const char *fname) +static void alan_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); } @@ -980,9 +980,9 @@ static void alan_exit(void) ff_vecs_t alanwpr_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, - ff_cap_read | ff_cap_write /* routes */ + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */ }, alan_rd_init, alan_wr_init, @@ -1001,7 +1001,7 @@ ff_vecs_t alantrl_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, alan_rd_init, diff --git a/gpsbabel/an1.c b/gpsbabel/an1.c index 0e6a89714..b80f66a53 100644 --- a/gpsbabel/an1.c +++ b/gpsbabel/an1.c @@ -27,18 +27,18 @@ #define MYNAME "an1" #include "defs.h" -static gbfile *infile; -static gbfile *outfile; - -static char *output_type = NULL; -static char *road_changes = NULL; -static char *nogc = NULL; -static char *nourl = NULL; -static char *opt_symbol = NULL; -static char *opt_color = NULL; -static char *opt_zoom = NULL; -static char *opt_wpt_type = NULL; -static char *opt_radius = NULL; +static gbfile* infile; +static gbfile* outfile; + +static char* output_type = NULL; +static char* road_changes = NULL; +static char* nogc = NULL; +static char* nourl = NULL; +static char* opt_symbol = NULL; +static char* opt_color = NULL; +static char* opt_zoom = NULL; +static char* opt_wpt_type = NULL; +static char* opt_radius = NULL; static short output_type_num = 0; static short opt_zoom_num = 0; @@ -52,10 +52,10 @@ static long rtserial=1; typedef struct roadchange { long type; - char *name; + char* name; } roadchange; -roadchange *roadchanges = NULL; +roadchange* roadchanges = NULL; static arglist_t an1_args[] = { @@ -114,11 +114,11 @@ typedef struct guid { #define ReadDouble(f) gbfgetdbl(f) #define WriteDouble(f,d) gbfputdbl((d),f) -static char * -ReadString(gbfile * f, short len) +static char* +ReadString(gbfile* f, short len) { - char *result = NULL; - result = (char *)xcalloc(1, len + 1); + char* result = NULL; + result = (char*)xcalloc(1, len + 1); if (len) { gbfread(result, 1, len, f); } @@ -130,7 +130,7 @@ ReadString(gbfile * f, short len) #define WriteString(f,s) gbfputs((s),f) static void -ReadGuid(gbfile *f, GUID *guid) +ReadGuid(gbfile* f, GUID* guid) { int i = 0; guid->l = ReadLong(f); @@ -143,7 +143,7 @@ ReadGuid(gbfile *f, GUID *guid) } static void -WriteGuid(gbfile *f, GUID *guid) +WriteGuid(gbfile* f, GUID* guid) { int i = 0; WriteLong(f, guid->l); @@ -156,7 +156,7 @@ WriteGuid(gbfile *f, GUID *guid) } static void -Skip(gbfile * f, +Skip(gbfile* f, unsigned long distance) { gbfseek(f, distance, SEEK_CUR); @@ -179,7 +179,7 @@ typedef struct { long hotspoty; long unk1; GUID guid; - char *name; + char* name; } an1_symbol_record; typedef struct { @@ -199,8 +199,8 @@ typedef struct { unsigned char visible_zoom; short unk5; double radius; /* in km */ - char *name; - char *fontname; + char* name; + char* fontname; GUID guid; long fontcolor; long fontstyle; @@ -214,11 +214,11 @@ typedef struct { /* Added in SA2006/Topo 6.0 */ short unk6_1; - char *url; - char *comment; + char* url; + char* comment; long creation_time; long modification_time; - char *image_name; + char* image_name; } an1_waypoint_record; typedef struct { @@ -238,7 +238,7 @@ typedef struct { short unk3; short type; long unk4; - char *name; + char* name; long lineweight; long linestyle; long linecolor; @@ -250,12 +250,12 @@ typedef struct { long pointcount; } an1_line_record; -static an1_waypoint_record *Alloc_AN1_Waypoint(); +static an1_waypoint_record* Alloc_AN1_Waypoint(); -void Destroy_AN1_Waypoint(void *vwpt) +void Destroy_AN1_Waypoint(void* vwpt) { - an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt; + an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt; xfree(wpt->name); xfree(wpt->fontname); if (wpt->url) { @@ -270,23 +270,23 @@ void Destroy_AN1_Waypoint(void *vwpt) xfree(vwpt); } -void Copy_AN1_Waypoint(void **vdwpt, void *vwpt) +void Copy_AN1_Waypoint(void** vdwpt, void* vwpt) { - an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt; - an1_waypoint_record *dwpt = Alloc_AN1_Waypoint(); + an1_waypoint_record* wpt = (an1_waypoint_record*)vwpt; + an1_waypoint_record* dwpt = Alloc_AN1_Waypoint(); memcpy(dwpt, wpt, sizeof(an1_waypoint_record)); dwpt->name = xstrdup(wpt->name); dwpt->fontname = xstrdup(wpt->fontname); dwpt->url = xstrdup(wpt->url); dwpt->comment = xstrdup(wpt->comment); dwpt->image_name = xstrdup(wpt->image_name); - *vdwpt = (void *)dwpt; + *vdwpt = (void*)dwpt; } -static an1_waypoint_record *Alloc_AN1_Waypoint() +static an1_waypoint_record* Alloc_AN1_Waypoint() { - an1_waypoint_record *result = NULL; - result = (an1_waypoint_record *)xcalloc(sizeof(*result), 1); + an1_waypoint_record* result = NULL; + result = (an1_waypoint_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1W; result->fs.copy = Copy_AN1_Waypoint; result->fs.destroy = Destroy_AN1_Waypoint; @@ -294,25 +294,25 @@ static an1_waypoint_record *Alloc_AN1_Waypoint() return result; } -static an1_vertex_record *Alloc_AN1_Vertex(); +static an1_vertex_record* Alloc_AN1_Vertex(); -void Destroy_AN1_Vertex(void *vvertex) +void Destroy_AN1_Vertex(void* vvertex) { xfree(vvertex); } -void Copy_AN1_Vertex(void **vdvert, void *vvert) +void Copy_AN1_Vertex(void** vdvert, void* vvert) { - an1_vertex_record *vert = (an1_vertex_record *)vvert; - an1_vertex_record *dvert = Alloc_AN1_Vertex(); + an1_vertex_record* vert = (an1_vertex_record*)vvert; + an1_vertex_record* dvert = Alloc_AN1_Vertex(); memcpy(dvert, vert, sizeof(an1_vertex_record)); - *vdvert = (void *)dvert; + *vdvert = (void*)dvert; } -static an1_vertex_record *Alloc_AN1_Vertex() +static an1_vertex_record* Alloc_AN1_Vertex() { - an1_vertex_record *result = NULL; - result = (an1_vertex_record *)xcalloc(sizeof(*result), 1); + an1_vertex_record* result = NULL; + result = (an1_vertex_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1V; result->fs.copy = Copy_AN1_Vertex; result->fs.destroy = Destroy_AN1_Vertex; @@ -321,28 +321,28 @@ static an1_vertex_record *Alloc_AN1_Vertex() } -static an1_line_record *Alloc_AN1_Line(); +static an1_line_record* Alloc_AN1_Line(); -void Destroy_AN1_Line(void *vline) +void Destroy_AN1_Line(void* vline) { - an1_line_record *line = (an1_line_record *)vline; + an1_line_record* line = (an1_line_record*)vline; xfree(line->name); xfree(vline); } -void Copy_AN1_Line(void **vdline, void *vline) +void Copy_AN1_Line(void** vdline, void* vline) { - an1_line_record *line = (an1_line_record *)vline; - an1_line_record *dline = Alloc_AN1_Line(); + an1_line_record* line = (an1_line_record*)vline; + an1_line_record* dline = Alloc_AN1_Line(); memcpy(dline, line, sizeof(an1_line_record)); dline->name = xstrdup(line->name); - *vdline = (void *)dline; + *vdline = (void*)dline; } -static an1_line_record *Alloc_AN1_Line() +static an1_line_record* Alloc_AN1_Line() { - an1_line_record *result = NULL; - result = (an1_line_record *)xcalloc(sizeof(*result), 1); + an1_line_record* result = NULL; + result = (an1_line_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1L; result->fs.copy = Copy_AN1_Line; result->fs.destroy = Destroy_AN1_Line; @@ -351,12 +351,12 @@ static an1_line_record *Alloc_AN1_Line() } -static void Destroy_AN1_Symbol(an1_symbol_record *symbol) +static void Destroy_AN1_Symbol(an1_symbol_record* symbol) { xfree(symbol->name); } -static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) +static void Read_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) { short len; @@ -381,7 +381,7 @@ static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) if (len != strlen(wpt->name)) { /* This happens in 06/6.0 files that put extra data in the * name record for backward compatibility's sake */ - char *ofs = wpt->name + strlen(wpt->name) + 1; + char* ofs = wpt->name + strlen(wpt->name) + 1; wpt->unk6_1 = le_read16(ofs); ofs += 2; @@ -389,7 +389,7 @@ static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) ofs += 2; if (len) { - char *oldurlstr; + char* oldurlstr; /* * Trust URL encoded in new format over one in * old format if both are present. Whack the @@ -446,7 +446,7 @@ static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) wpt->fillflags = ReadLong(f); } -static void Write_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) +static void Write_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) { short len; @@ -530,7 +530,7 @@ static void Write_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt) WriteLong(f, wpt->fillflags); } -static void Read_AN1_Vertex(gbfile *f, an1_vertex_record *vertex) +static void Read_AN1_Vertex(gbfile* f, an1_vertex_record* vertex) { vertex->magic = ReadShort(f); @@ -540,7 +540,7 @@ static void Read_AN1_Vertex(gbfile *f, an1_vertex_record *vertex) vertex->unk1 = ReadShort(f); } -static void Write_AN1_Vertex(gbfile *f, an1_vertex_record *vertex) +static void Write_AN1_Vertex(gbfile* f, an1_vertex_record* vertex) { WriteShort(f, vertex->magic); WriteLong(f, vertex->unk0); @@ -549,7 +549,7 @@ static void Write_AN1_Vertex(gbfile *f, an1_vertex_record *vertex) WriteShort(f, vertex->unk1); } -static void Read_AN1_Line(gbfile *f, an1_line_record *line) +static void Read_AN1_Line(gbfile* f, an1_line_record* line) { short len; @@ -573,7 +573,7 @@ static void Read_AN1_Line(gbfile *f, an1_line_record *line) line->pointcount = ReadLong(f); } -static void Write_AN1_Line(gbfile *f, an1_line_record *line) +static void Write_AN1_Line(gbfile* f, an1_line_record* line) { short len; @@ -597,12 +597,12 @@ static void Write_AN1_Line(gbfile *f, an1_line_record *line) WriteLong(f, line->pointcount); } -static void Skip_AN1_IL(gbfile *f) +static void Skip_AN1_IL(gbfile* f) { Skip(f, 26); } -static void Skip_AN1_BM(gbfile *f) +static void Skip_AN1_BM(gbfile* f) { unsigned long bmsize; unsigned long palettesize; @@ -621,7 +621,7 @@ static void Skip_AN1_BM(gbfile *f) Skip(f, bmsize + palettesize); } -static void Read_AN1_Symbol(gbfile *f, an1_symbol_record *symbol) +static void Read_AN1_Symbol(gbfile* f, an1_symbol_record* symbol) { short len; @@ -635,7 +635,7 @@ static void Read_AN1_Symbol(gbfile *f, an1_symbol_record *symbol) symbol->name = ReadString(f, len); } -static void Read_AN1_Header(gbfile *f) +static void Read_AN1_Header(gbfile* f) { unsigned short magic; unsigned short type; @@ -646,13 +646,13 @@ static void Read_AN1_Header(gbfile *f) last_read_type = type; } -static void Write_AN1_Header(gbfile *f) +static void Write_AN1_Header(gbfile* f) { WriteShort(f, 11557); WriteShort(f, output_type_num); } -static void Read_AN1_Bitmaps(gbfile *f) +static void Read_AN1_Bitmaps(gbfile* f) { long count; unsigned short magic; @@ -680,21 +680,21 @@ static void Read_AN1_Bitmaps(gbfile *f) /* Read the symbol table */ } -static void Write_AN1_Bitmaps(gbfile *f) +static void Write_AN1_Bitmaps(gbfile* f) { /* On write, we don't output any bitmaps, so writing them * is just a matter of writing a count of zero */ WriteLong(f, 0); } -static void Read_AN1_Waypoints(gbfile *f) +static void Read_AN1_Waypoints(gbfile* f) { unsigned long count = 0; unsigned long i = 0; - an1_waypoint_record *rec = NULL; - waypoint *wpt_tmp; - char *icon = NULL; - char *url = NULL; + an1_waypoint_record* rec = NULL; + waypoint* wpt_tmp; + char* icon = NULL; + char* url = NULL; ReadShort(f); count = ReadLong(f); for (i = 0; i < count; i++) { @@ -724,22 +724,22 @@ static void Read_AN1_Waypoints(gbfile *f) wpt_tmp->icon_descr = icon; } - fs_chain_add(&(wpt_tmp->fs), (format_specific_data *)rec); + fs_chain_add(&(wpt_tmp->fs), (format_specific_data*)rec); rec = NULL; waypt_add(wpt_tmp); } } static void -Write_One_AN1_Waypoint(const waypoint *wpt) +Write_One_AN1_Waypoint(const waypoint* wpt) { - an1_waypoint_record *rec; + an1_waypoint_record* rec; int local; - format_specific_data *fs = NULL; + format_specific_data* fs = NULL; fs = fs_chain_find(wpt->fs, FS_AN1W); if (fs) { - rec = (an1_waypoint_record *)fs; + rec = (an1_waypoint_record*)fs; xfree(rec->name); local = 0; if (opt_zoom) { @@ -769,7 +769,7 @@ Write_One_AN1_Waypoint(const waypoint *wpt) rec->name = xstrdup(wpt->description); if (!nogc && wpt->gc_data->id) { - char *extra = (char *) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname)); + char* extra = (char*) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname)); sprintf(extra, "\r\nBy %s\r\n%s (%1.1f/%1.1f)", wpt->gc_data->placer, wpt->shortname, wpt->gc_data->diff/10.0, @@ -780,7 +780,7 @@ Write_One_AN1_Waypoint(const waypoint *wpt) if (!nourl && wpt->url) { int len = 7+strlen(wpt->url); - char *extra = (char *)xmalloc(len); + char* extra = (char*)xmalloc(len); sprintf(extra, "{URL=%s}", wpt->url); rec->name = xstrappend(rec->name, extra); xfree(extra); @@ -808,7 +808,7 @@ Write_One_AN1_Waypoint(const waypoint *wpt) } } if (!rec->image_name && wpt->icon_descr) { - FindIconByName((char *)(void *)wpt->icon_descr, &rec->guid); + FindIconByName((char*)(void*)wpt->icon_descr, &rec->guid); } Write_AN1_Waypoint(outfile, rec); @@ -817,22 +817,22 @@ Write_One_AN1_Waypoint(const waypoint *wpt) } } -static void Write_AN1_Waypoints(gbfile *f) +static void Write_AN1_Waypoints(gbfile* f) { WriteShort(f, 2); WriteLong(f, waypt_count()); waypt_disp_all(Write_One_AN1_Waypoint); } -static void Read_AN1_Lines(gbfile *f) +static void Read_AN1_Lines(gbfile* f) { unsigned long count = 0; unsigned long i = 0; unsigned long j = 0; - an1_line_record *rec = NULL; - an1_vertex_record *vert = NULL; - route_head *rte_head; - waypoint *wpt_tmp; + an1_line_record* rec = NULL; + an1_vertex_record* vert = NULL; + route_head* rte_head; + waypoint* wpt_tmp; ReadShort(f); count = ReadLong(f); @@ -852,7 +852,7 @@ static void Read_AN1_Lines(gbfile *f) rte_head->line_width = rec->lineweight; } rte_head->rte_name = xstrdup(rec->name); - fs_chain_add(&rte_head->fs, (format_specific_data *)rec); + fs_chain_add(&rte_head->fs, (format_specific_data*)rec); route_add_head(rte_head); for (j = 0; j < (unsigned) rec->pointcount; j++) { vert = Alloc_AN1_Vertex(); @@ -862,17 +862,17 @@ static void Read_AN1_Lines(gbfile *f) wpt_tmp = waypt_new(); wpt_tmp->latitude = DecodeOrd(vert->lat); wpt_tmp->longitude = -DecodeOrd(vert->lon); - wpt_tmp->shortname = (char *) xmalloc(7); + wpt_tmp->shortname = (char*) xmalloc(7); sprintf(wpt_tmp->shortname, "\\%5.5lx", rtserial++); fs_chain_add(&wpt_tmp->fs, - (format_specific_data *)vert); + (format_specific_data*)vert); route_add_wpt(rte_head, wpt_tmp); } } } static void -Make_Road_Changes(an1_line_record *rec) +Make_Road_Changes(an1_line_record* rec) { int i = 0; @@ -894,16 +894,16 @@ Make_Road_Changes(an1_line_record *rec) } static void -Write_One_AN1_Line(const route_head *rte) +Write_One_AN1_Line(const route_head* rte) { - an1_line_record *rec; + an1_line_record* rec; int local; - format_specific_data *fs = NULL; + format_specific_data* fs = NULL; fs = fs_chain_find(rte->fs, FS_AN1L); if (fs) { - rec = (an1_line_record *)(void *)fs; + rec = (an1_line_record*)(void*)fs; local = 0; switch (output_type_num) { case 1: @@ -991,16 +991,16 @@ Write_One_AN1_Line(const route_head *rte) } static void -Write_One_AN1_Vertex(const waypoint *wpt) +Write_One_AN1_Vertex(const waypoint* wpt) { - an1_vertex_record *rec; + an1_vertex_record* rec; int local; - format_specific_data *fs = NULL; + format_specific_data* fs = NULL; fs = fs_chain_find(wpt->fs, FS_AN1V); if (fs) { - rec = (an1_vertex_record *)(void *)fs; + rec = (an1_vertex_record*)(void*)fs; local = 0; } else { rec = Alloc_AN1_Vertex(); @@ -1016,7 +1016,7 @@ Write_One_AN1_Vertex(const waypoint *wpt) } } -static void Write_AN1_Lines(gbfile *f) +static void Write_AN1_Lines(gbfile* f) { WriteShort(f, 2); WriteLong(f, route_count()+track_count()); @@ -1085,7 +1085,7 @@ Init_Output_Type(void) } static long -Parse_Change_Type(char *type) +Parse_Change_Type(char* type) { long retval = 0x11100541; @@ -1134,10 +1134,10 @@ static void Init_Road_Changes(void) { int count = 0; - char *strType = NULL; - char *name = NULL; - char *bar = NULL; - char *copy = NULL; + char* strType = NULL; + char* name = NULL; + char* bar = NULL; + char* copy = NULL; Free_Road_Changes(); if (!road_changes || !road_changes[0]) { @@ -1152,7 +1152,7 @@ Init_Road_Changes(void) fatal(MYNAME ": invalid format for road changes\n"); } count = 1 + count / 2; - roadchanges = (roadchange *)xmalloc((count+1) * sizeof(roadchange)); + roadchanges = (roadchange*)xmalloc((count+1) * sizeof(roadchange)); roadchanges[count].type = 0; roadchanges[count].name = NULL; @@ -1180,7 +1180,7 @@ Init_Road_Changes(void) } static void -rd_init(const char *fname) +rd_init(const char* fname) { infile = gbfopen_le(fname, "rb", MYNAME); } @@ -1201,7 +1201,7 @@ my_read(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { outfile = gbfopen_le(fname, "wb", MYNAME); Init_Output_Type(); diff --git a/gpsbabel/an1sym.h b/gpsbabel/an1sym.h index 3904fad27..8cbdcd4f5 100644 --- a/gpsbabel/an1sym.h +++ b/gpsbabel/an1sym.h @@ -62,7 +62,7 @@ struct defguid { GUID guid; - const char *name; + const char* name; } default_guids[] = { { {0xb610bc70,{0x377e, 0x11d6, 0xaeb3}, {0x00, 0x01, 0x02, 0x31, 0x5f, 0xfd}}, "Hiker" @@ -708,7 +708,7 @@ struct defguid { }, }; -int FindIconByName(const char *name, GUID *guid) +int FindIconByName(const char* name, GUID* guid) { int i = 0; for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { @@ -720,7 +720,7 @@ int FindIconByName(const char *name, GUID *guid) return 0; } -int FindIconByGuid(GUID *guid, char **name) +int FindIconByGuid(GUID* guid, char** name) { int i = 0; for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) { diff --git a/gpsbabel/arcdist.c b/gpsbabel/arcdist.c index f7b493e3a..eac069f06 100644 --- a/gpsbabel/arcdist.c +++ b/gpsbabel/arcdist.c @@ -26,10 +26,10 @@ #define MYNAME "Arc filter" static double pos_dist; -static char *distopt = NULL; -static char *arcfileopt = NULL; -static char *exclopt = NULL; -static char *ptsopt = NULL; +static char* distopt = NULL; +static char* arcfileopt = NULL; +static char* exclopt = NULL; +static char* ptsopt = NULL; typedef struct { double distance; @@ -61,20 +61,20 @@ arglist_t arcdist_args[] = { void arcdist_process(void) { - queue * elem, * tmp; - waypoint * waypointp; + queue* elem, * tmp; + waypoint* waypointp; double dist; - extra_data *ed; + extra_data* ed; double lat1, lon1, lat2, lon2; int fileline = 0; - char *line; - gbfile *file_in; + char* line; + gbfile* file_in; file_in = gbfopen(arcfileopt, "r", MYNAME); lat1 = lon1 = lat2 = lon2 = BADVAL; while ((line = gbfgetstr(file_in))) { - char *pound = NULL; + char* pound = NULL; int argsfound = 0; fileline++; @@ -96,11 +96,11 @@ arcdist_process(void) (ptsopt || (lat1 != BADVAL && lon1 != BADVAL))) { QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *)elem; + waypointp = (waypoint*)elem; if (waypointp->extra_data) { - ed = (extra_data *) waypointp->extra_data; + ed = (extra_data*) waypointp->extra_data; } else { - ed = (extra_data *) xcalloc(1, sizeof(*ed)); + ed = (extra_data*) xcalloc(1, sizeof(*ed)); ed->distance = BADVAL; } if (ed->distance == BADVAL || ed->distance >= pos_dist) { @@ -131,8 +131,8 @@ arcdist_process(void) gbfclose(file_in); QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypoint *wp = (waypoint *) elem; - ed = (extra_data *) wp->extra_data; + waypoint* wp = (waypoint*) elem; + ed = (extra_data*) wp->extra_data; wp->extra_data = NULL; if (ed) { if ((ed->distance >= pos_dist) == (exclopt == NULL)) { @@ -145,9 +145,9 @@ arcdist_process(void) } void -arcdist_init(const char *args) +arcdist_init(const char* args) { - char *fm; + char* fm; pos_dist = 0; diff --git a/gpsbabel/avltree.c b/gpsbabel/avltree.c index 388f7fcc0..caccace9c 100644 --- a/gpsbabel/avltree.c +++ b/gpsbabel/avltree.c @@ -30,21 +30,21 @@ #endif #ifdef MEM_DEBUG -void avltree_check_handle(const void *tree); +void avltree_check_handle(const void* tree); #endif -static void avltree_node_free(const avltree_t *tree, avlnode_t *node); -static int avltree_node_height(avlnode_t *node); -static int avltree_insert_node(avltree_t *tree, avlnode_t **root, const char *key, const void *data); -static int avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *changed); -static avlnode_t *avltree_right_rotation(avlnode_t *A); -static avlnode_t *avltree_left_rotation(avlnode_t *A); -static avlnode_t *avltree_left_right_rotation(avlnode_t *A); -static avlnode_t *avltree_right_left_rotation(avlnode_t *A); -static avlnode_t *avltree_dupe_node(const avltree_t *tree, const avlnode_t *node); -static int avltree_strcmpr(const char *s1, const char *s2); -static int avltree_case_ignore_strcmpr(const char *s1, const char *s2); -static avlnode_t *avltree_find_next(const avltree_t *tree, avlnode_t *node, const char *key); -static void avltree_save_key(avltree_t *tree, const char *key); +static void avltree_node_free(const avltree_t* tree, avlnode_t* node); +static int avltree_node_height(avlnode_t* node); +static int avltree_insert_node(avltree_t* tree, avlnode_t** root, const char* key, const void* data); +static int avltree_delete_node(avltree_t* tree, const char* key, avlnode_t** root, int* changed); +static avlnode_t* avltree_right_rotation(avlnode_t* A); +static avlnode_t* avltree_left_rotation(avlnode_t* A); +static avlnode_t* avltree_left_right_rotation(avlnode_t* A); +static avlnode_t* avltree_right_left_rotation(avlnode_t* A); +static avlnode_t* avltree_dupe_node(const avltree_t* tree, const avlnode_t* node); +static int avltree_strcmpr(const char* s1, const char* s2); +static int avltree_case_ignore_strcmpr(const char* s1, const char* s2); +static avlnode_t* avltree_find_next(const avltree_t* tree, avlnode_t* node, const char* key); +static void avltree_save_key(avltree_t* tree, const char* key); #ifdef MEM_DEBUG @@ -59,10 +59,10 @@ static void avltree_save_key(avltree_t *tree, const char *key); /* Allocate and initialize an AVL Tree */ -avltree_t * -avltree_init(const int options, const char *module) +avltree_t* +avltree_init(const int options, const char* module) { - avltree_t *tree; + avltree_t* tree; if ((module == NULL) || (*module == '\0')) { fatal(MYNAME ": 'avltree_init' should be called with a valid module name!\n"); @@ -92,7 +92,7 @@ avltree_init(const int options, const char *module) /* Delete all items of tree [tree] */ int -avltree_clear(avltree_t *tree) +avltree_clear(avltree_t* tree) { int res; @@ -112,7 +112,7 @@ avltree_clear(avltree_t *tree) /* Destroy an AVL Tree */ void -avltree_done(avltree_t *tree) +avltree_done(avltree_t* tree) { avltree_clear(tree); xfree(tree); @@ -122,7 +122,7 @@ avltree_done(avltree_t *tree) /* Get number of items in tree */ int -avltree_count(const avltree_t *tree) +avltree_count(const avltree_t* tree) { AVLTREE_CHECK_HANDLE(tree); @@ -133,7 +133,7 @@ avltree_count(const avltree_t *tree) /* Delete item with key [key] */ int -avltree_delete(avltree_t *tree, const char *key) +avltree_delete(avltree_t* tree, const char* key) { int changed = 0; @@ -149,10 +149,10 @@ avltree_delete(avltree_t *tree, const char *key) /* Duplicate an existing tree */ -avltree_t * -avltree_dupe(const avltree_t *tree, const char *module) +avltree_t* +avltree_dupe(const avltree_t* tree, const char* module) { - avltree_t *dupe; + avltree_t* dupe; AVLTREE_CHECK_HANDLE(tree); @@ -168,9 +168,9 @@ avltree_dupe(const avltree_t *tree, const char *module) /* Find key [key] in tree */ int -avltree_find(const avltree_t *tree, const char *key, const void **data) +avltree_find(const avltree_t* tree, const char* key, const void** data) { - avlnode_t *node; + avlnode_t* node; AVLTREE_CHECK_HANDLE(tree); @@ -196,10 +196,10 @@ avltree_find(const avltree_t *tree, const char *key, const void **data) /* Get the first (the MIN-) entry of the tree */ -const char * -avltree_first(const avltree_t *tree, const void **data) +const char* +avltree_first(const avltree_t* tree, const void** data) { - avlnode_t *node; + avlnode_t* node; AVLTREE_CHECK_HANDLE(tree); @@ -211,7 +211,7 @@ avltree_first(const avltree_t *tree, const void **data) while (node->left) { node = node->left; } - avltree_save_key((avltree_t *)tree, node->key); + avltree_save_key((avltree_t*)tree, node->key); if (data) { (*data) = node->data; } @@ -223,7 +223,7 @@ avltree_first(const avltree_t *tree, const void **data) /* Get the current height of the tree */ int -avltree_height(const avltree_t *tree) +avltree_height(const avltree_t* tree) { AVLTREE_CHECK_HANDLE(tree); @@ -238,7 +238,7 @@ avltree_height(const avltree_t *tree) /* Insert key [key] and [data] into tree */ int -avltree_insert(avltree_t *tree, const char *key, const void *data) +avltree_insert(avltree_t* tree, const char* key, const void* data) { int count; @@ -256,10 +256,10 @@ avltree_insert(avltree_t *tree, const char *key, const void *data) /* Get the next (the entry above [key]) */ -const char * -avltree_next(const avltree_t *tree, const char *key, const void **data) +const char* +avltree_next(const avltree_t* tree, const char* key, const void** data) { - avlnode_t *node; + avlnode_t* node; AVLTREE_CHECK_HANDLE(tree); @@ -273,12 +273,12 @@ avltree_next(const avltree_t *tree, const char *key, const void **data) } if ((node = avltree_find_next(tree, node, key))) { - avltree_save_key((avltree_t *)tree, node->key); + avltree_save_key((avltree_t*)tree, node->key); if (data) { (*data) = node->data; } } else { - avltree_save_key((avltree_t *)tree, NULL); + avltree_save_key((avltree_t*)tree, NULL); } return tree->key; @@ -291,7 +291,7 @@ avltree_next(const avltree_t *tree, const char *key, const void **data) #ifdef MEM_DEBUG void -avltree_check_handle(const avltree_t *tree) +avltree_check_handle(const avltree_t* tree) { if (! tree) { fatal(MYNAME ": Invalid (NULL-) pointer!\n"); @@ -305,10 +305,10 @@ avltree_check_handle(const avltree_t *tree) static void -avltree_node_free(const avltree_t *tree, avlnode_t *node) +avltree_node_free(const avltree_t* tree, avlnode_t* node) { if ((!(tree->options & AVLTREE_STATIC_KEYS)) && node->key) { - xfree((char *)node->key); + xfree((char*)node->key); } if (node->left) { avltree_node_free(tree, node->left); @@ -321,7 +321,7 @@ avltree_node_free(const avltree_t *tree, avlnode_t *node) static int -avltree_node_height(avlnode_t *node) +avltree_node_height(avlnode_t* node) { int height = 1; @@ -335,8 +335,8 @@ avltree_node_height(avlnode_t *node) } -static avlnode_t * -avltree_right_rotation(avlnode_t *A) +static avlnode_t* +avltree_right_rotation(avlnode_t* A) { /* > A B @@ -348,7 +348,7 @@ avltree_right_rotation(avlnode_t *A) > . > / \ */ - avlnode_t *B; + avlnode_t* B; B = A->right; A->right = B->left; @@ -364,8 +364,8 @@ avltree_right_rotation(avlnode_t *A) } -static avlnode_t * -avltree_left_rotation(avlnode_t *A) +static avlnode_t* +avltree_left_rotation(avlnode_t* A) { /* > A B @@ -377,7 +377,7 @@ avltree_left_rotation(avlnode_t *A) > . > / \ */ - avlnode_t *B; + avlnode_t* B; B = A->left; A->left = B->right; @@ -393,8 +393,8 @@ avltree_left_rotation(avlnode_t *A) } -static avlnode_t * -avltree_left_right_rotation(avlnode_t *A) +static avlnode_t* +avltree_left_right_rotation(avlnode_t* A) { /* > A C @@ -405,7 +405,7 @@ avltree_left_right_rotation(avlnode_t *A) > \ > C */ - avlnode_t *B, *C; + avlnode_t* B, *C; B = A->left; C = B->right; @@ -425,8 +425,8 @@ avltree_left_right_rotation(avlnode_t *A) } -static avlnode_t * -avltree_right_left_rotation(avlnode_t *A) +static avlnode_t* +avltree_right_left_rotation(avlnode_t* A) { /* > A C @@ -437,7 +437,7 @@ avltree_right_left_rotation(avlnode_t *A) > / > C */ - avlnode_t *B, *C; + avlnode_t* B, *C; B = A->right; C = B->left; @@ -458,11 +458,11 @@ avltree_right_left_rotation(avlnode_t *A) static int -avltree_insert_node(avltree_t *tree, avlnode_t **root, const char *key, const void *data) +avltree_insert_node(avltree_t* tree, avlnode_t** root, const char* key, const void* data) { int changed = 0; int compare; - avlnode_t *node = (*root); + avlnode_t* node = (*root); if (node == NULL) { (*root) = node = (avlnode_t*) xcalloc(1, sizeof(*node)); @@ -535,9 +535,9 @@ avltree_insert_node(avltree_t *tree, avlnode_t **root, const char *key, const vo static int -avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *changed) +avltree_delete_node(avltree_t* tree, const char* key, avlnode_t** root, int* changed) { - avlnode_t *node = (*root); + avlnode_t* node = (*root); int deleted = 0; int compare; @@ -603,9 +603,9 @@ avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *cha } else { if (node->left) { if (node->right) { - const char *temp_key; - const void *temp_data; - avlnode_t *succ = node->right; + const char* temp_key; + const void* temp_data; + avlnode_t* succ = node->right; while (succ->left) { succ = succ->left; /* find successor */ @@ -665,10 +665,10 @@ avltree_delete_node(avltree_t *tree, const char *key, avlnode_t **root, int *cha } -static avlnode_t * -avltree_dupe_node(const avltree_t *tree, const avlnode_t *node) +static avlnode_t* +avltree_dupe_node(const avltree_t* tree, const avlnode_t* node) { - avlnode_t *res = (avlnode_t*) xcalloc(1, sizeof(*res)); + avlnode_t* res = (avlnode_t*) xcalloc(1, sizeof(*res)); if (tree->options & AVLTREE_STATIC_KEYS) { res->key = node->key; @@ -689,23 +689,23 @@ avltree_dupe_node(const avltree_t *tree, const avlnode_t *node) static int -avltree_strcmpr(const char *s1, const char *s2) +avltree_strcmpr(const char* s1, const char* s2) { return -(strcmp(s1, s2)); } static int -avltree_case_ignore_strcmpr(const char *s1, const char *s2) +avltree_case_ignore_strcmpr(const char* s1, const char* s2) { return -(case_ignore_strcmp(s1, s2)); } -static avlnode_t * -avltree_find_next(const avltree_t *tree, avlnode_t *node, const char *key) +static avlnode_t* +avltree_find_next(const avltree_t* tree, avlnode_t* node, const char* key) { - avlnode_t *prev = NULL; + avlnode_t* prev = NULL; if (key == NULL) { if ((node = tree->root)) { @@ -749,14 +749,14 @@ avltree_find_next(const avltree_t *tree, avlnode_t *node, const char *key) } */ static void -avltree_save_key(avltree_t *tree, const char *key) +avltree_save_key(avltree_t* tree, const char* key) { if (tree->options & AVLTREE_STATIC_KEYS) { tree->key = key; } else { if (key == NULL) { if (tree->key_sz) { - xfree((char *)tree->key); + xfree((char*)tree->key); tree->key_sz = 0; } tree->key = NULL; @@ -770,11 +770,11 @@ avltree_save_key(avltree_t *tree, const char *key) if (tree->key_sz == 0) { tree->key = (char*) xmalloc(n8); } else { - tree->key = (char *) xrealloc((char *)tree->key, n8); + tree->key = (char*) xrealloc((char*)tree->key, n8); } tree->key_sz = n8; } - strncpy((char *)tree->key, key, n); + strncpy((char*)tree->key, key, n); } } } diff --git a/gpsbabel/avltree.h b/gpsbabel/avltree.h index e1e73277d..c08c3a8b3 100644 --- a/gpsbabel/avltree.h +++ b/gpsbabel/avltree.h @@ -27,27 +27,27 @@ #include #include -typedef int (*avltree_compare_cb)(const char *, const char *); +typedef int (*avltree_compare_cb)(const char*, const char*); typedef struct avltree_s { #ifdef MEM_DEBUG const int magic; #endif - struct avlnode_s *root; - const char *module; + struct avlnode_s* root; + const char* module; int count; /* number of items in tree */ int options; - const char *key; + const char* key; int key_sz; avltree_compare_cb compare; } avltree_t; typedef struct avlnode_s { int balance; - const char *key; - const void *data; - struct avlnode_s *left; - struct avlnode_s *right; + const char* key; + const void* data; + struct avlnode_s* left; + struct avlnode_s* right; } avlnode_t; /* options for avltree_init */ @@ -60,37 +60,37 @@ typedef struct avlnode_s { #define AVLTREE_PARANOIAC 256 /* STOP on "duplicate key" (insert) or on "not found" (delete) */ /* Allocate and initialize an AVL Tree */ -avltree_t *avltree_init(const int options, const char *module); +avltree_t* avltree_init(const int options, const char* module); /* Destroy an AVL Tree */ -void avltree_done(avltree_t *tree); +void avltree_done(avltree_t* tree); /* Delete all items of tree [tree]; returns number of deleted items */ -int avltree_clear(avltree_t *tree); +int avltree_clear(avltree_t* tree); /* Get number of items in tree */ -int avltree_count(const avltree_t *tree); +int avltree_count(const avltree_t* tree); /* Delete item with key [key] */ -int avltree_delete(avltree_t *tree, const char *key); +int avltree_delete(avltree_t* tree, const char* key); /* Duplicate an existing tree */ -avltree_t *avltree_dupe(const avltree_t *tree, const char *module); +avltree_t* avltree_dupe(const avltree_t* tree, const char* module); /* Find key [key] in tree */ -int avltree_find(const avltree_t *tree, const char *key, const void **data); +int avltree_find(const avltree_t* tree, const char* key, const void** data); /* Get the first (the MIN-) entry of the tree */ -const char *avltree_first(const avltree_t *tree, const void **data); +const char* avltree_first(const avltree_t* tree, const void** data); /* Get the current height of the tree */ -int avltree_height(const avltree_t *tree); +int avltree_height(const avltree_t* tree); /* Insert key [key] and [data] into tree */ -int avltree_insert(avltree_t *tree, const char *key, const void *data); +int avltree_insert(avltree_t* tree, const char* key, const void* data); /* Get the next (the entry above [key]) */ -const char *avltree_next(const avltree_t *tree, const char *key, const void **data); +const char* avltree_next(const avltree_t* tree, const char* key, const void** data); #endif /* AVLTREE_H_INCLUDED */ diff --git a/gpsbabel/axim_gpb.c b/gpsbabel/axim_gpb.c index 4621f3873..97fcf4bd8 100644 --- a/gpsbabel/axim_gpb.c +++ b/gpsbabel/axim_gpb.c @@ -29,7 +29,7 @@ #define RECORD_LEN 344 -static gbfile *fin; +static gbfile* fin; static arglist_t axim_gpb_args[] = { @@ -37,7 +37,7 @@ arglist_t axim_gpb_args[] = { }; static float -le_read32_float(const void *src) +le_read32_float(const void* src) { float f; gbint32 i; @@ -49,36 +49,36 @@ le_read32_float(const void *src) } static void -decode_buff(const char *buff, route_head *track) +decode_buff(const char* buff, route_head* track) { struct tm tm; double lat, lon, alt, dir; float vdop, hdop, pdop, spd, Uf1; int sats; - waypoint *wpt; + waypoint* wpt; wpt = waypt_new(); memset(&tm, '\0', sizeof(tm)); - tm.tm_year = le_read16((void *)(buff + 16)); - tm.tm_mon = le_read16((void *)(buff + 18)); - tm.tm_mday = le_read16((void *)(buff + 22)); - tm.tm_hour = le_read16((void *)(buff + 24)); - tm.tm_min = le_read16((void *)(buff + 26)); - tm.tm_sec = le_read16((void *)(buff + 28)); - lat = le_read_double((void *)(buff + 32)); - lon = le_read_double((void *)(buff + 40)); - spd = le_read32_float((void *)(buff + 48)); - dir = le_read32_float((void *)(buff + 52)); - - alt = le_read32_float((void *)(buff + 64)); - Uf1 = le_read32_float((void *)(buff + 68)); - - hdop = le_read32_float((void *)(buff + 84)); - vdop = le_read32_float((void *)(buff + 88)); - pdop = le_read32_float((void *)(buff + 92)); - sats = le_read16((void *)(buff + 96)); + tm.tm_year = le_read16((void*)(buff + 16)); + tm.tm_mon = le_read16((void*)(buff + 18)); + tm.tm_mday = le_read16((void*)(buff + 22)); + tm.tm_hour = le_read16((void*)(buff + 24)); + tm.tm_min = le_read16((void*)(buff + 26)); + tm.tm_sec = le_read16((void*)(buff + 28)); + lat = le_read_double((void*)(buff + 32)); + lon = le_read_double((void*)(buff + 40)); + spd = le_read32_float((void*)(buff + 48)); + dir = le_read32_float((void*)(buff + 52)); + + alt = le_read32_float((void*)(buff + 64)); + Uf1 = le_read32_float((void*)(buff + 68)); + + hdop = le_read32_float((void*)(buff + 84)); + vdop = le_read32_float((void*)(buff + 88)); + pdop = le_read32_float((void*)(buff + 92)); + sats = le_read16((void*)(buff + 96)); wpt->latitude = lat; wpt->longitude = lon; @@ -122,7 +122,7 @@ decode_buff(const char *buff, route_head *track) *******************************************************************************/ static void -axim_gpb_rd_init(const char *fname) +axim_gpb_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); } @@ -137,7 +137,7 @@ static void axim_gpb_read(void) { char buff[RECORD_LEN]; - route_head *track = NULL; + route_head* track = NULL; size_t bytes; while ((bytes = gbfread(buff, 1, RECORD_LEN, fin))) { diff --git a/gpsbabel/bcr.c b/gpsbabel/bcr.c index 859221b7e..5561e379a 100644 --- a/gpsbabel/bcr.c +++ b/gpsbabel/bcr.c @@ -50,18 +50,18 @@ but this seems to be used by Map&Guide when exporting to XML. */ -static gbfile *fout; -static char *filename; +static gbfile* fout; +static char* filename; static int curr_rte_num, target_rte_num; static double radius; -static inifile_t *ini; +static inifile_t* ini; /* placeholders for options */ -static char *rtenum_opt; -static char *rtename_opt; -static char *radius_opt; -static char *prefer_shortnames_opt; +static char* rtenum_opt; +static char* rtename_opt; +static char* radius_opt; +static char* prefer_shortnames_opt; static arglist_t bcr_args[] = { @@ -85,9 +85,9 @@ arglist_t bcr_args[] = { }; typedef struct { - const char *bcr_name; - const char *mps_name; - const char *symbol_DE; + const char* bcr_name; + const char* mps_name; + const char* symbol_DE; int warned; } bcr_icon_mapping_t; @@ -126,9 +126,9 @@ bcr_icon_mapping_t bcr_icon_mapping[] = { }; static void -bcr_handle_icon_str(const char *str, waypoint *wpt) +bcr_handle_icon_str(const char* str, waypoint* wpt) { - bcr_icon_mapping_t *m; + bcr_icon_mapping_t* m; wpt->icon_descr = BCR_DEF_MPS_ICON; @@ -153,13 +153,13 @@ bcr_handle_icon_str(const char *str, waypoint *wpt) } } -static const char * -get_bcr_icon_from_icon_descr(const char *icon_descr) +static const char* +get_bcr_icon_from_icon_descr(const char* icon_descr) { - const char *result = BCR_DEF_ICON; + const char* result = BCR_DEF_ICON; if (icon_descr) { - bcr_icon_mapping_t *m; + bcr_icon_mapping_t* m; for (m = bcr_icon_mapping; (m->bcr_name); m++) { if (! m->mps_name) { @@ -192,7 +192,7 @@ bcr_init_radius(void) } static void -bcr_rd_init(const char *fname) +bcr_rd_init(const char* fname) { filename = xstrdup(fname); ini = inifile_init(fname, MYNAME); @@ -212,19 +212,19 @@ bcr_rd_deinit(void) /* ------------------------------------------------------------*/ static void -bcr_create_waypts_from_route(route_head *route) +bcr_create_waypts_from_route(route_head* route) { - waypoint *wpt; - queue *elem, *tmp; + waypoint* wpt; + queue* elem, *tmp; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - wpt = waypt_dupe((waypoint *) elem); + wpt = waypt_dupe((waypoint*) elem); waypt_add(wpt); } } static void -bcr_wgs84_to_mercator(const double lat, const double lon, int *north, int *east) +bcr_wgs84_to_mercator(const double lat, const double lon, int* north, int* east) { double N, E; @@ -247,7 +247,7 @@ bcr_wgs84_to_mercator(const double lat, const double lon, int *north, int *east) } void -bcr_mercator_to_wgs84(const int north, const int east, double *lat, double *lon) +bcr_mercator_to_wgs84(const int north, const int east, double* lat, double* lon) { *lat = 2 * (atan(exp(north / radius)) - M_PI / 4) / M_PI * (double)180; *lon = (double)east * (double)180 / (radius * M_PI); @@ -259,8 +259,8 @@ static void bcr_data_read(void) { int index; - char *str; - route_head *route; + char* str; + route_head* route; route = route_head_alloc(); @@ -273,9 +273,9 @@ bcr_data_read(void) for (index = 1; index > 0; index ++) { char station[32]; - char *str; + char* str; int mlat, mlon; /* mercator data */ - waypoint *wpt; + waypoint* wpt; snprintf(station, sizeof(station), "STATION%d", index); if (NULL == (str = inifile_readstr(ini, "coordinates", station))) { @@ -292,7 +292,7 @@ bcr_data_read(void) bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude); if (NULL != (str = inifile_readstr(ini, "client", station))) { - char *cx; + char* cx; cx = strchr(str, ','); if (cx == NULL) { @@ -303,7 +303,7 @@ bcr_data_read(void) } if (NULL != (str = inifile_readstr(ini, "description", station))) { - char *c; + char* c; c = strchr(str, ','); if (c != NULL) { @@ -339,7 +339,7 @@ bcr_data_read(void) /* %%% bcr write support %%% ----------------------------------- */ static void -bcr_wr_init(const char *fname) +bcr_wr_init(const char* fname) { filename = xstrdup(fname); fout = gbfopen(fname, "wb", MYNAME); @@ -354,22 +354,22 @@ bcr_wr_deinit(void) } static void -bcr_route_trailer(const route_head *rte) +bcr_route_trailer(const route_head* rte) { } static void -bcr_write_wpt(const waypoint *wpt) +bcr_write_wpt(const waypoint* wpt) { } -void bcr_write_line(gbfile *fout, const char *key, int *index, const char *value) +void bcr_write_line(gbfile* fout, const char* key, int* index, const char* value) { if (value == NULL) { /* this is mostly used in the world of windows */ /* so we respectfully add a CR/LF on each line */ gbfprintf(fout, "%s\r\n", key); } else { - char *tmp; + char* tmp; tmp = (value != NULL) ? xstrdup(value) : xstrdup(""); if (index != NULL) { @@ -382,11 +382,11 @@ void bcr_write_line(gbfile *fout, const char *key, int *index, const char *value } static void -bcr_route_header(const route_head *route) +bcr_route_header(const route_head* route) { - queue *elem, *tmp; - waypoint *wpt; - char *sout; + queue* elem, *tmp; + waypoint* wpt; + char* sout; int i, north, east, nmin, nmax, emin, emax; curr_rte_num++; @@ -411,8 +411,8 @@ bcr_route_header(const route_head *route) i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - const char *icon; - waypoint *wpt = (waypoint *) elem; + const char* icon; + waypoint* wpt = (waypoint*) elem; i++; @@ -431,7 +431,7 @@ bcr_route_header(const route_head *route) i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { i++; - wpt = (waypoint *) elem; + wpt = (waypoint*) elem; bcr_wgs84_to_mercator(wpt->latitude, wpt->longitude, &north, &east); @@ -457,10 +457,10 @@ bcr_route_header(const route_head *route) i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - char *s1, *s2, *sout; + char* s1, *s2, *sout; i++; - wpt = (waypoint *) elem; + wpt = (waypoint*) elem; s1 = wpt->notes; if (s1 == NULL) { s1 = wpt->description; @@ -521,7 +521,7 @@ bcr_data_write(void) ff_vecs_t bcr_vecs = { ff_type_file, - { ff_cap_none, ff_cap_none, ff_cap_read | ff_cap_write}, + { ff_cap_none, ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write)}, bcr_rd_init, bcr_wr_init, bcr_rd_deinit, diff --git a/gpsbabel/brauniger_iq.c b/gpsbabel/brauniger_iq.c index dbed7c59a..43f00122a 100644 --- a/gpsbabel/brauniger_iq.c +++ b/gpsbabel/brauniger_iq.c @@ -22,7 +22,7 @@ #include "gbser.h" #include -static void *serial_handle; +static void* serial_handle; #define MYNAME "BRAUNIGER-IQ" #define PRESTRKNAME "PRESALTTRK" @@ -49,7 +49,7 @@ static enum { static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 }; -static void rd_init(const char *fname) +static void rd_init(const char* fname) { if (serial_handle = gbser_init(fname), NULL == serial_handle) { fatal(MYNAME ": Can't open port '%s'\n", fname); @@ -69,15 +69,15 @@ static void rd_deinit(void) * Process a data record. * @return zero when all expected data has been received */ -static int process_data(const unsigned char *data) +static int process_data(const unsigned char* data) { static int remaining = 100; static struct tm tm; static time_t start, creation; - static route_head *track; + static route_head* track; static unsigned char interval; time_t finish; - waypoint *wpt = NULL; + waypoint* wpt = NULL; int i; if (global_opts.debug_level >= 3) { diff --git a/gpsbabel/bushnell.c b/gpsbabel/bushnell.c index f73aadd6f..aafe1478c 100644 --- a/gpsbabel/bushnell.c +++ b/gpsbabel/bushnell.c @@ -23,8 +23,8 @@ #include "defs.h" #define MYNAME "Bushnell" -static gbfile *file_in; -static char *ofname; +static gbfile* file_in; +static char* ofname; static short_handle mkshort_handle = NULL; static @@ -37,7 +37,7 @@ arglist_t bushnell_args[] = { typedef struct { const signed int symbol; - const char *icon; + const char* icon; } icon_mapping_t; icon_mapping_t bushnell_icons[] = { @@ -126,9 +126,9 @@ icon_mapping_t bushnell_icons[] = { }; static unsigned int -bushnell_get_icon_from_name(const char *name) +bushnell_get_icon_from_name(const char* name) { - icon_mapping_t *t; + icon_mapping_t* t; for (t = bushnell_icons; t->icon > 0; t++) { if (0 == case_ignore_strcmp(name, t->icon)) { return t->symbol; @@ -137,10 +137,10 @@ bushnell_get_icon_from_name(const char *name) return 0; } -static const char * +static const char* bushnell_get_name_from_symbol(signed int s) { - icon_mapping_t *t; + icon_mapping_t* t; for (t = bushnell_icons; t->icon > 0; t++) { if (s == t->symbol) { return t->icon; @@ -150,7 +150,7 @@ bushnell_get_name_from_symbol(signed int s) } static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -162,9 +162,9 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { - char *dot, *slash; + char* dot, *slash; static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" ".-/\\~@#$%^&*()_+=<>" "abcdefghijklmnopqrstuvwxyz"; @@ -199,7 +199,7 @@ bushnell_read(void) gbint32 lat_tmp,lon_tmp; unsigned int proximity; unsigned int icon; - waypoint *wpt_tmp = waypt_new(); + waypoint* wpt_tmp = waypt_new(); lat_tmp = gbfgetint32(file_in); lon_tmp = gbfgetint32(file_in); @@ -219,14 +219,14 @@ bushnell_read(void) } static void -bushnell_write_one(const waypoint *wpt) +bushnell_write_one(const waypoint* wpt) { char tbuf[20]; // 19 text bytes + null terminator. char padding[2] = {0, 0}; - gbfile *file_out; + gbfile* file_out; static int wpt_count; - char *fname; - char *ident; + char* fname; + char* ident; xasprintf(&fname, "%s-%d.wpt", ofname, wpt_count++); file_out = gbfopen_le(fname, "wb", MYNAME); diff --git a/gpsbabel/bushnell_trl.c b/gpsbabel/bushnell_trl.c index 0c6a6cbba..941c2f445 100644 --- a/gpsbabel/bushnell_trl.c +++ b/gpsbabel/bushnell_trl.c @@ -23,8 +23,8 @@ #include "defs.h" #define MYNAME "Bushnell Trail" -static gbfile *file_in; -static gbfile *file_out; +static gbfile* file_in; +static gbfile* file_out; static int trkpt_count; static route_head* trk_head; @@ -34,7 +34,7 @@ arglist_t bushnell_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { char h[0x14]; // Believed to be zero terminated. file_in = gbfopen_le(fname, "rb", MYNAME); @@ -53,11 +53,11 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { int i,l = strlen(fname); char obuf[20] = { 0 } ; - char *p = obuf; + char* p = obuf; file_out = gbfopen_le(fname, "w", MYNAME); trkpt_count = 0; for (i = 0; (i < l) && (i < 20); i++) { @@ -97,7 +97,7 @@ bushnell_read(void) int lat_tmp,lon_tmp; while (1) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; lat_tmp = gbfgetint32(file_in); lon_tmp = gbfgetint32(file_in); @@ -115,7 +115,7 @@ bushnell_read(void) } static void -bushnell_write_one(const waypoint *wpt) +bushnell_write_one(const waypoint* wpt) { gbint32 lat = wpt->latitude * 10000000.0; gbint32 lon = wpt->longitude * 10000000.0; @@ -136,7 +136,7 @@ bushnell_write(void) ff_vecs_t bushnell_trl_vecs = { ff_type_file, - { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none }, + { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none }, rd_init, wr_init, rd_deinit, diff --git a/gpsbabel/cet.c b/gpsbabel/cet.c index 8264e6e77..73dfd93c1 100644 --- a/gpsbabel/cet.c +++ b/gpsbabel/cet.c @@ -40,10 +40,10 @@ */ int -cet_char_to_ucs4(const char src, const cet_cs_vec_t *vec, int *value) +cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value) { int trash, c; - int *dest; + int* dest; c = ((unsigned char)src & 0xFF); dest = (value != NULL) ? value : &trash; @@ -70,13 +70,13 @@ cet_char_to_ucs4(const char src, const cet_cs_vec_t *vec, int *value) */ int -cet_ucs4_to_utf8(char *dest, size_t dest_size, int value) +cet_ucs4_to_utf8(char* dest, size_t dest_size, int value) { int result; unsigned char trash[16]; - unsigned char *c; + unsigned char* c; - c = (dest != NULL) ? (unsigned char *) dest : trash; + c = (dest != NULL) ? (unsigned char*) dest : trash; if ((value & 0xffffff80) == 0) { /* <= 7 bits */ if (dest_size < 1) { @@ -143,9 +143,9 @@ cet_ucs4_to_utf8(char *dest, size_t dest_size, int value) * return values: 0 if success, otherwise 1 */ int -cet_utf8_to_ucs4(const char *str, int *bytes, int *value) +cet_utf8_to_ucs4(const char* str, int* bytes, int* value) { - unsigned char *cp = (unsigned char *)str; + unsigned char* cp = (unsigned char*)str; if (*cp < 0x80) { if (bytes != NULL) { @@ -168,7 +168,7 @@ cet_utf8_to_ucs4(const char *str, int *bytes, int *value) if ((*cp & 0xc0) != 0x80) { break; /* invalid */ } else if (i == 0) { /* all valid */ - char *c = (char *)str; /* found valid sequence, now storing value */ + char* c = (char*)str; /* found valid sequence, now storing value */ int res = *c++ & (mask ^ 0xFF); i = len; while (i-- > 0) { @@ -206,11 +206,11 @@ cet_utf8_to_ucs4(const char *str, int *bytes, int *value) * if not possible */ short -cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec) +cet_ucs4_to_char(const int value, const cet_cs_vec_t* vec) { - cet_ucs4_link_t *link; + cet_ucs4_link_t* link; - if ((link = (cet_ucs4_link_t *)vec->ucs4_link)) { + if ((link = (cet_ucs4_link_t*)vec->ucs4_link)) { int i = 0; int j = vec->ucs4_links - 1; /* validate ucs value against vec */ while (i <= j) { @@ -227,7 +227,7 @@ cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec) } } - if ((link = (cet_ucs4_link_t *)vec->ucs4_extra)) { /* can be NULL */ + if ((link = (cet_ucs4_link_t*)vec->ucs4_extra)) { /* can be NULL */ int i = 0; int j = vec->ucs4_extras - 1; while (i <= j) { @@ -262,7 +262,7 @@ cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec) */ short -cet_utf8_to_char(const char *str, const cet_cs_vec_t *vec, /* out */ int *bytes, int *value) +cet_utf8_to_char(const char* str, const cet_cs_vec_t* vec, /* out */ int* bytes, int* value) { int b, v; @@ -287,10 +287,10 @@ cet_utf8_to_char(const char *str, const cet_cs_vec_t *vec, /* out */ int *bytes, * Returns the number of valid (visible) characters. */ unsigned int -cet_utf8_strlen(const char *str) +cet_utf8_strlen(const char* str) { if (str) { - const char *cin = str; + const char* cin = str; int len = 0; while (*cin) { @@ -310,8 +310,8 @@ cet_utf8_strlen(const char *str) * * Checks and duplicates an UTF-8 string */ -char * -cet_utf8_strdup(const char *str) +char* +cet_utf8_strdup(const char* str) { if (str) { return cet_utf8_strndup(str, strlen(str)); @@ -324,12 +324,12 @@ cet_utf8_strdup(const char *str) * * Checks and duplicates an UTF-8 string */ -char * -cet_utf8_strndup(const char *str, const int maxlen) +char* +cet_utf8_strndup(const char* str, const int maxlen) { if (str) { - const char *cin = str; - char *res, *cout; + const char* cin = str; + char* res, *cout; int len = 0; res = cout = xstrdup(cin); @@ -364,12 +364,12 @@ cet_utf8_strndup(const char *str, const int maxlen) * * Converts a UTF-8 string to given character set */ -char * -cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec) +char* +cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec) { - char *c = (char *)src; + char* c = (char*)src; int len; - char *res, *dest, *cend; + char* res, *dest, *cend; if (c == NULL) { return NULL; @@ -379,7 +379,7 @@ cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec) } len = strlen(c); - res = dest = (char *) xmalloc(len + 1); /* target will become smaller or equal length */ + res = dest = (char*) xmalloc(len + 1); /* target will become smaller or equal length */ cend = c + len; @@ -398,14 +398,14 @@ cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec) * * Converts a string from given character set to UTF-8 */ -char * -cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec) +char* +cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec) { int len, value; - char *result, *cin, *cout; + char* result, *cin, *cout; char temp = CET_NOT_CONVERTABLE_DEFAULT; - cin = (char *)src; + cin = (char*)src; if (cin == NULL) { return NULL; } @@ -421,8 +421,8 @@ cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec) len += cet_ucs4_to_utf8(NULL, 6, value); } - result = cout = (char *) xmalloc(len + 1); - cin = (char *)src; + result = cout = (char*) xmalloc(len + 1); + cin = (char*)src; while (*cin != '\0') { if (CET_ERROR == cet_char_to_ucs4(*cin++, vec, &value)) { @@ -438,12 +438,12 @@ cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec) * * Converts an unicode string to UTF-8 */ -char * -cet_str_uni_to_utf8(const short *src, const int length) +char* +cet_str_uni_to_utf8(const short* src, const int length) { int i, len; - unsigned short *cin; - char *res, *cout; + unsigned short* cin; + char* res, *cout; if (src == NULL) { return NULL; @@ -451,14 +451,14 @@ cet_str_uni_to_utf8(const short *src, const int length) len = 0; i = length; - cin = (unsigned short *)src; + cin = (unsigned short*)src; while (i-- > 0) { len += cet_ucs4_to_utf8(NULL, 6, le_read16(cin++)); } - res = cout = (char *) xmalloc(len + 1); - cin = (unsigned short *)src; + res = cout = (char*) xmalloc(len + 1); + cin = (unsigned short*)src; i = length; while (i-- > 0) { @@ -474,12 +474,12 @@ cet_str_uni_to_utf8(const short *src, const int length) * * Converts a string in given character set to a 'wide string' (unicode) */ -short * -cet_str_any_to_uni(const char *src, const cet_cs_vec_t *vec, int *length) +short* +cet_str_any_to_uni(const char* src, const cet_cs_vec_t* vec, int* length) { - char *utf8; + char* utf8; int len; - short *res, *sout; + short* res, *sout; if (! src) { utf8 = xstrdup(""); @@ -490,10 +490,10 @@ cet_str_any_to_uni(const char *src, const cet_cs_vec_t *vec, int *length) } len = cet_utf8_strlen(utf8); - res = sout = (short int *) xcalloc(2, len + 1); + res = sout = (short int*) xcalloc(2, len + 1); if (len) { - char *cin = utf8; + char* cin = utf8; while (*cin) { int bytes, value; diff --git a/gpsbabel/cet.h b/gpsbabel/cet.h index 33ffc7d50..0ba382365 100644 --- a/gpsbabel/cet.h +++ b/gpsbabel/cet.h @@ -34,46 +34,46 @@ typedef struct cet_ucs4_link_s { } cet_ucs4_link_t; typedef struct cet_cs_vec_s { - const char *name; /* name of character set */ - const char **alias; /* alias table */ - struct cet_cs_vec_s *fallback; /* fallback character set */ - void *unused; - const int *ucs4_map; /* char to UCS-4 value table */ + const char* name; /* name of character set */ + const char** alias; /* alias table */ + struct cet_cs_vec_s* fallback; /* fallback character set */ + void* unused; + const int* ucs4_map; /* char to UCS-4 value table */ const int ucs4_offset; /* first non standard character */ const int ucs4_count; /* values in table */ - const cet_ucs4_link_t *ucs4_link; /* UCS-4 to char backward links */ + const cet_ucs4_link_t* ucs4_link; /* UCS-4 to char backward links */ const int ucs4_links; /* number of links */ - const cet_ucs4_link_t *ucs4_extra; /* Non standard UCS-4 to ... */ + const cet_ucs4_link_t* ucs4_extra; /* Non standard UCS-4 to ... */ const int ucs4_extras; /* number of extra links */ - struct cet_cs_vec_s *next; + struct cet_cs_vec_s* next; } cet_cs_vec_t; /* single char/value transmission */ -int cet_utf8_to_ucs4(const char *str, int *bytes, int *value); -int cet_ucs4_to_utf8(char *dest, size_t dest_size, int value); +int cet_utf8_to_ucs4(const char* str, int* bytes, int* value); +int cet_ucs4_to_utf8(char* dest, size_t dest_size, int value); /* single char/value transmission - vec based */ -int cet_char_to_ucs4(const char src, const cet_cs_vec_t *vec, int *value); -short cet_utf8_to_char(const char *str, const cet_cs_vec_t *vecint, int *bytes, int *value); -short cet_ucs4_to_char(const int value, const cet_cs_vec_t *vec); +int cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value); +short cet_utf8_to_char(const char* str, const cet_cs_vec_t* vecint, int* bytes, int* value); +short cet_ucs4_to_char(const int value, const cet_cs_vec_t* vec); /* string to string - vector based */ -char *cet_str_utf8_to_any(const char *src, const cet_cs_vec_t *vec); -char *cet_str_any_to_utf8(const char *src, const cet_cs_vec_t *vec); +char* cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec); +char* cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec); -char *cet_str_uni_to_utf8(const short *src, const int length); +char* cet_str_uni_to_utf8(const short* src, const int length); /* UTF-8 string manipulation functions */ -unsigned int cet_utf8_strlen(const char *str); -char *cet_utf8_strdup(const char *str); -char *cet_utf8_strndup(const char *str, const int maxlen); +unsigned int cet_utf8_strlen(const char* str); +char* cet_utf8_strdup(const char* str); +char* cet_utf8_strndup(const char* str, const int maxlen); /* unicode functions */ -short *cet_str_any_to_uni(const char *src, const cet_cs_vec_t *vec, int *length); +short* cet_str_any_to_uni(const char* src, const cet_cs_vec_t* vec, int* length); #endif diff --git a/gpsbabel/cet_util.c b/gpsbabel/cet_util.c index 612a77217..2832208fb 100644 --- a/gpsbabel/cet_util.c +++ b/gpsbabel/cet_util.c @@ -36,14 +36,14 @@ #define MYNAME "cet_util" -static cet_cs_vec_t *cet_cs_vec_root = NULL; +static cet_cs_vec_t* cet_cs_vec_root = NULL; typedef struct cet_cs_alias_s { - char *name; - cet_cs_vec_t *vec; + char* name; + cet_cs_vec_t* vec; } cet_cs_alias_t; -static cet_cs_alias_t *cet_cs_alias; +static cet_cs_alias_t* cet_cs_alias; static int cet_cs_alias_ct = 0; static int cet_cs_vec_ct = 0; static int cet_output = 0; @@ -59,79 +59,79 @@ static int cet_output = 0; /* %%% short hand strings transmission for main character sets %%% */ -char * -cet_str_utf8_to_iso8859_1(const char *src) +char* +cet_str_utf8_to_iso8859_1(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_1); } -char * -cet_str_iso8859_1_to_utf8(const char *src) +char* +cet_str_iso8859_1_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_1); } -char * -cet_str_utf8_to_iso8859_8(const char *src) +char* +cet_str_utf8_to_iso8859_8(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_8); } -char * -cet_str_iso8859_8_to_utf8(const char *src) +char* +cet_str_iso8859_8_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_8); } -char * -cet_str_utf8_to_iso8859_15(const char *src) +char* +cet_str_utf8_to_iso8859_15(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_iso_8859_15); } -char * -cet_str_iso8859_15_to_utf8(const char *src) +char* +cet_str_iso8859_15_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_iso_8859_15); } -char * -cet_str_utf8_to_us_ascii(const char *src) +char* +cet_str_utf8_to_us_ascii(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_ansi_x3_4_1968); } -char * -cet_str_us_ascii_to_utf8(const char *src) +char* +cet_str_us_ascii_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_ansi_x3_4_1968); } -char * -cet_str_utf8_to_cp1252(const char *src) +char* +cet_str_utf8_to_cp1252(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_cp1252); } -char * -cet_str_cp1252_to_utf8(const char *src) +char* +cet_str_cp1252_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_cp1252); } -char * -cet_str_utf8_to_cp1255(const char *src) +char* +cet_str_utf8_to_cp1255(const char* src) { return cet_str_utf8_to_any(src, &cet_cs_vec_cp1255); } -char * -cet_str_cp1255_to_utf8(const char *src) +char* +cet_str_cp1255_to_utf8(const char* src) { return cet_str_any_to_utf8(src, &cet_cs_vec_cp1255); } -short * -cet_str_utf8_to_uni(const char *src, int *length) +short* +cet_str_utf8_to_uni(const char* src, int* length) { return cet_str_any_to_uni(src, &cet_cs_vec_utf8, length); } @@ -145,11 +145,11 @@ cet_str_utf8_to_uni(const char *src, int *length) * */ #if HAVE_LIBEXPAT -int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *xml_encoding, XML_Encoding *info) +int XMLCALL cet_lib_expat_UnknownEncodingHandler(void* data, const XML_Char* xml_encoding, XML_Encoding* info) { - cet_cs_vec_t *cs; + cet_cs_vec_t* cs; int i, c, ucs4_def; - const char *encoding; + const char* encoding; encoding = xml_convert_to_char_string(xml_encoding); cs = cet_find_cs_by_name(encoding); @@ -189,11 +189,11 @@ int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *xml #endif -char * -cet_str_uni_to_any(const short *src, int length, const cet_cs_vec_t *dest_vec) +char* +cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec) { - char *res, *c; - const cet_cs_vec_t *cs = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; + char* res, *c; + const cet_cs_vec_t* cs = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; res = cet_str_uni_to_utf8(src, length); if (cs != &cet_cs_vec_utf8) { @@ -208,12 +208,12 @@ cet_str_uni_to_any(const short *src, int length, const cet_cs_vec_t *dest_vec) * * -->> for use in mkshort */ -char * -cet_str_any_to_any(const char *src, const cet_cs_vec_t *src_vec, const cet_cs_vec_t *dest_vec) +char* +cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, const cet_cs_vec_t* dest_vec) { - char *c0, *c1; - const cet_cs_vec_t *v_in = (src_vec != NULL) ? src_vec : &cet_cs_vec_ansi_x3_4_1968; - const cet_cs_vec_t *v_out = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; + char* c0, *c1; + const cet_cs_vec_t* v_in = (src_vec != NULL) ? src_vec : &cet_cs_vec_ansi_x3_4_1968; + const cet_cs_vec_t* v_out = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; if (src == NULL) { return NULL; @@ -235,11 +235,11 @@ cet_str_any_to_any(const char *src, const cet_cs_vec_t *src_vec, const cet_cs_ve */ int -cet_valid_char(const char *src, const cet_cs_vec_t *vec) +cet_valid_char(const char* src, const cet_cs_vec_t* vec) { int value; - const cet_cs_vec_t *v = (vec != NULL) ? vec : &cet_cs_vec_ansi_x3_4_1968; + const cet_cs_vec_t* v = (vec != NULL) ? vec : &cet_cs_vec_ansi_x3_4_1968; return cet_char_to_ucs4(*src, v, &value); } @@ -369,11 +369,11 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #ifdef DEBUG_MEM void -cet_check_cs(cet_cs_vec_t *vec) /* test well sorted link & extra tables */ +cet_check_cs(cet_cs_vec_t* vec) /* test well sorted link & extra tables */ { - cet_ucs4_link_t *link; + cet_ucs4_link_t* link; - if ((link = (cet_ucs4_link_t *)vec->ucs4_link)) { + if ((link = (cet_ucs4_link_t*)vec->ucs4_link)) { int i, j; for (i = 0, j = 1; j < vec->ucs4_links; i++, j++) { @@ -384,7 +384,7 @@ cet_check_cs(cet_cs_vec_t *vec) /* test well sorted link & extra tables */ } } - if ((link = (cet_ucs4_link_t *)vec->ucs4_extra)) { + if ((link = (cet_ucs4_link_t*)vec->ucs4_extra)) { int i, j; for (i = 0, j = 1; j < vec->ucs4_extras; i++, j++) { @@ -400,23 +400,23 @@ cet_check_cs(cet_cs_vec_t *vec) /* test well sorted link & extra tables */ #endif static signed int -cet_cs_alias_qsort_cb(const void *a, const void *b) +cet_cs_alias_qsort_cb(const void* a, const void* b) { - const cet_cs_alias_t *va = (const cet_cs_alias_t*) a; - const cet_cs_alias_t *vb = (const cet_cs_alias_t*) b; + const cet_cs_alias_t* va = (const cet_cs_alias_t*) a; + const cet_cs_alias_t* vb = (const cet_cs_alias_t*) b; return case_ignore_strcmp(va->name, vb->name); } static signed int -cet_cs_vec_qsort_cb(const void *a, const void *b) +cet_cs_vec_qsort_cb(const void* a, const void* b) { - const cet_cs_vec_t *va = *(cet_cs_vec_t **)a; - const cet_cs_vec_t *vb = *(cet_cs_vec_t **)b; + const cet_cs_vec_t* va = *(cet_cs_vec_t**)a; + const cet_cs_vec_t* vb = *(cet_cs_vec_t**)b; return case_ignore_strcmp(va->name, vb->name); } void -cet_register_cs(cet_cs_vec_t *vec) +cet_register_cs(cet_cs_vec_t* vec) { if (vec->next == NULL) { vec->next = cet_cs_vec_root; @@ -430,7 +430,7 @@ cet_register_cs(cet_cs_vec_t *vec) /* Dummy vector for our native character set */ -const char *cet_cs_utf8_alias[] = { +const char* cet_cs_utf8_alias[] = { "utf8", NULL }; @@ -798,8 +798,8 @@ cet_register(void) #endif if (cet_cs_vec_ct > 0) { - cet_cs_vec_t *p; - cet_cs_alias_t *list; + cet_cs_vec_t* p; + cet_cs_alias_t* list; c = 0; /* enumerate count of all names and aliases */ @@ -807,7 +807,7 @@ cet_register(void) for (p = cet_cs_vec_root; p != NULL; p = p->next) { c++; if (p->alias != NULL) { - char **a = (char **)p->alias; + char** a = (char**)p->alias; while ((*a) != NULL) { a++; c++; @@ -820,7 +820,7 @@ cet_register(void) i = 0; for (p = cet_cs_vec_root; p != NULL; p = p->next) { if (p->alias != NULL) { - char **a = (char **)p->alias; + char** a = (char**)p->alias; list[i].name = xstrdup(p->name); list[i].vec = p; @@ -840,7 +840,7 @@ cet_register(void) /* install fallback for ascii-like (first 128 ch.) character sets */ for (i = 1250; i <= 1258; i++) { char name[16]; - cet_cs_vec_t *vec; + cet_cs_vec_t* vec; snprintf(name, sizeof(name), "WIN-CP%d", i); if ((vec = cet_find_cs_by_name(name))) { @@ -849,7 +849,7 @@ cet_register(void) } for (i = 1; i <= 15; i++) { char name[16]; - cet_cs_vec_t *vec; + cet_cs_vec_t* vec; snprintf(name, sizeof(name), "ISO-8859-%d", i); if ((vec = cet_find_cs_by_name(name))) { @@ -862,8 +862,8 @@ cet_register(void) #endif } -cet_cs_vec_t * -cet_find_cs_by_name(const char *name) +cet_cs_vec_t* +cet_find_cs_by_name(const char* name) { int i, j; @@ -878,7 +878,7 @@ cet_find_cs_by_name(const char *name) while (i <= j) { int a, x; - cet_cs_alias_t *n; + cet_cs_alias_t* n; a = (i + j) >> 1; n = &cet_cs_alias[a]; @@ -899,7 +899,7 @@ cet_deregister(void) { int i; int j = cet_cs_alias_ct; - cet_cs_alias_t *p = cet_cs_alias; + cet_cs_alias_t* p = cet_cs_alias; if (p == NULL) { return; @@ -917,9 +917,9 @@ cet_deregister(void) /* gpsbabel additions */ int -cet_validate_cs(const char *cs, cet_cs_vec_t **vec, char **cs_name) +cet_validate_cs(const char* cs, cet_cs_vec_t** vec, char** cs_name) { - cet_cs_vec_t *v; + cet_cs_vec_t* v; if ((cs == NULL) || (strlen(cs) == 0)) { /* set default us-ascii */ *vec = &cet_cs_vec_ansi_x3_4_1968; @@ -950,7 +950,7 @@ cet_convert_deinit(void) } void -cet_convert_init(const char *cs_name, const int force) +cet_convert_init(const char* cs_name, const int force) { if ((force != 0) || (global_opts.charset == NULL)) { cet_convert_deinit(); @@ -963,15 +963,15 @@ cet_convert_init(const char *cs_name, const int force) /* -------------------------------------------------------------------- */ static void -cet_flag_waypt(const waypoint *wpt) +cet_flag_waypt(const waypoint* wpt) { - ((waypoint *)(wpt))->wpt_flags.cet_converted = 1; + ((waypoint*)(wpt))->wpt_flags.cet_converted = 1; } static void -cet_flag_route(const route_head *rte) +cet_flag_route(const route_head* rte) { - ((route_head *)(rte))->cet_converted = 1; + ((route_head*)(rte))->cet_converted = 1; } static void @@ -986,28 +986,28 @@ cet_flag_all(void) /* %%% complete data strings transformation %%% */ /* -------------------------------------------------------------------- */ -static char * (*converter)(const char *) = NULL; +static char* (*converter)(const char*) = NULL; /* two converters */ -static char * -cet_convert_to_utf8(const char *str) +static char* +cet_convert_to_utf8(const char* str) { return cet_str_any_to_utf8(str, global_opts.charset); } -static char * -cet_convert_from_utf8(const char *str) +static char* +cet_convert_from_utf8(const char* str) { return cet_str_utf8_to_any(str, global_opts.charset); } /* cet_convert_string: internal used within cet_convert_strings process */ -char * -cet_convert_string(char *str) +char* +cet_convert_string(char* str) { - char *res; + char* res; if (str == NULL) { return NULL; /* return origin if empty or NULL */ @@ -1023,12 +1023,12 @@ cet_convert_string(char *str) /* cet_convert_waypt: internal used within cet_convert_strings process */ static void -cet_convert_waypt(const waypoint *wpt) +cet_convert_waypt(const waypoint* wpt) { - waypoint *w = (waypoint *)wpt; - format_specific_data *fs; - url_link *url_next; - geocache_data *gc_data = (geocache_data *)wpt->gc_data; + waypoint* w = (waypoint*)wpt; + format_specific_data* fs; + url_link* url_next; + geocache_data* gc_data = (geocache_data*)wpt->gc_data; if ((cet_output == 0) && (w->wpt_flags.cet_converted != 0)) { return; @@ -1060,9 +1060,9 @@ cet_convert_waypt(const waypoint *wpt) /* cet_convert_route_hdr: internal used within cet_convert_strings process */ static void -cet_convert_route_hdr(const route_head *route) +cet_convert_route_hdr(const route_head* route) { - route_head *rte = (route_head *)route; + route_head* rte = (route_head*)route; if ((cet_output == 0) && (rte->cet_converted != 0)) { return; @@ -1078,7 +1078,7 @@ cet_convert_route_hdr(const route_head *route) /* cet_convert_route_tlr: internal used within cet_convert_strings process */ static void -cet_convert_route_tlr(const route_head *route) +cet_convert_route_tlr(const route_head* route) { } @@ -1089,9 +1089,9 @@ cet_convert_route_tlr(const route_head *route) * !!! One of "source" or "target" must be internal cet_cs_vec_utf8 or NULL !!! */ void -cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, const char *format) +cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, const char* format) { - char *cs_name_from, *cs_name_to; + char* cs_name_from, *cs_name_to; converter = NULL; @@ -1104,8 +1104,8 @@ cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, cons cet_output = 1; converter = cet_convert_from_utf8; - cs_name_from = (char *)cet_cs_vec_utf8.name; - cs_name_to = (char *)target->name; + cs_name_from = (char*)cet_cs_vec_utf8.name; + cs_name_to = (char*)target->name; } else { if ((target != NULL) && (target != &cet_cs_vec_utf8)) { fatal(MYNAME ": Internal error!\n"); @@ -1114,8 +1114,8 @@ cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, cons cet_output = 0; converter = cet_convert_to_utf8; - cs_name_to = (char *)cet_cs_vec_utf8.name; - cs_name_from = (char *)source->name; + cs_name_to = (char*)cet_cs_vec_utf8.name; + cs_name_from = (char*)source->name; } if (global_opts.debug_level > 0) { @@ -1138,11 +1138,11 @@ cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, cons * - Put all character set names and aliases to "FILE" - */ void -cet_disp_character_set_names(FILE *fout) +cet_disp_character_set_names(FILE* fout) { int i, c, ac; - cet_cs_vec_t *vec; - cet_cs_vec_t **list; + cet_cs_vec_t* vec; + cet_cs_vec_t** list; if (cet_cs_alias_ct == 0) { return; @@ -1157,7 +1157,7 @@ cet_disp_character_set_names(FILE *fout) fatal(MYNAME ": internal error \"%s\"!\n", "cet_disp_character_set_names"); } - list = (cet_cs_vec_t **)xcalloc(c, sizeof(*list)); + list = (cet_cs_vec_t**)xcalloc(c, sizeof(*list)); i = 0; /* fill the list */ for (vec = cet_cs_vec_root; vec != NULL; vec = vec->next) { @@ -1169,12 +1169,12 @@ cet_disp_character_set_names(FILE *fout) fprintf(fout, "GPSBabel builtin character sets: (-c option)\n"); for (i = 0; i < c; i++) { - char **a; + char** a; vec = list[i]; fprintf(fout, "\n* %s", vec->name); - a = (char **)vec->alias; + a = (char**)vec->alias; if (a != NULL) { int column = 0; int alias = 0; @@ -1200,10 +1200,10 @@ cet_disp_character_set_names(FILE *fout) * * - print any special hard-coded characters from inside a module - */ -int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...) +int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...) { int res; - char *cout; + char* cout; va_list args; va_start(args, fmt); @@ -1212,12 +1212,12 @@ int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, if (global_opts.charset != src_vec) { if (src_vec != &cet_cs_vec_utf8) { - char *ctemp = cet_str_any_to_utf8(cout, src_vec); + char* ctemp = cet_str_any_to_utf8(cout, src_vec); xfree(cout); cout = ctemp; } if (global_opts.charset != &cet_cs_vec_utf8) { - char *ctemp = cet_str_utf8_to_any(cout, global_opts.charset); + char* ctemp = cet_str_utf8_to_any(cout, global_opts.charset); xfree(cout); cout = ctemp; } @@ -1234,11 +1234,11 @@ int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, * words in native endianness. */ -const char *xml_convert_to_char_string_n(const XML_Char *src, int *n) +const char* xml_convert_to_char_string_n(const XML_Char* src, int* n) { #ifdef XML_UNICODE - char *utf8; - char *utf8b; + char* utf8; + char* utf8b; int i, j; /* @@ -1273,13 +1273,13 @@ const char *xml_convert_to_char_string_n(const XML_Char *src, int *n) * may be UNICODE16 words in native endianness. */ -const char *xml_convert_to_char_string(const XML_Char *src) +const char* xml_convert_to_char_string(const XML_Char* src) { #ifdef XML_UNICODE - char *utf8; - char *utf8b; + char* utf8; + char* utf8b; int i, j; - const XML_Char *in = src; + const XML_Char* in = src; /* Walk source array until we find source terminator */ i = 0; @@ -1304,21 +1304,21 @@ const char *xml_convert_to_char_string(const XML_Char *src) } -void xml_free_converted_string(const char *str) +void xml_free_converted_string(const char* str) { #ifdef XML_UNICODE - xfree((void *) str); + xfree((void*) str); #endif } -const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr) +const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr) { #ifdef XML_UNICODE // First count size of array int size = 0; int i; - const XML_Char **ptr; - const char **char_attrs; + const XML_Char** ptr; + const char** char_attrs; if (xml_attr == NULL) { return NULL; @@ -1329,7 +1329,7 @@ const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr) } // Allocate space - char_attrs = xmalloc((size + 1) * sizeof(char *)); + char_attrs = xmalloc((size + 1) * sizeof(char*)); // Duplicate strings for (i = 0; i < size; ++i) { @@ -1343,11 +1343,11 @@ const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr) #endif } -void xml_free_converted_attrs(const char **attr) +void xml_free_converted_attrs(const char** attr) { #ifdef XML_UNICODE while (attr != NULL && *attr != NULL) { - xfree((void *)*attr); + xfree((void*)*attr); ++attr; } #endif diff --git a/gpsbabel/cet_util.h b/gpsbabel/cet_util.h index a82e668a4..abb5d3345 100644 --- a/gpsbabel/cet_util.h +++ b/gpsbabel/cet_util.h @@ -36,29 +36,29 @@ typedef char XML_Char; #include "cet.h" -cet_cs_vec_t *cet_find_cs_by_name(const char *name); +cet_cs_vec_t* cet_find_cs_by_name(const char* name); void cet_register(void); void cet_deregister(void); /* short hand transmissions */ -char *cet_str_utf8_to_cp1252(const char *src); -char *cet_str_cp1252_to_utf8(const char *src); +char* cet_str_utf8_to_cp1252(const char* src); +char* cet_str_cp1252_to_utf8(const char* src); extern cet_cs_vec_t cet_cs_vec_cp1252; -char *cet_str_iso8859_1_to_utf8(const char *src); -char *cet_str_utf8_to_iso8859_1(const char *src); +char* cet_str_iso8859_1_to_utf8(const char* src); +char* cet_str_utf8_to_iso8859_1(const char* src); extern cet_cs_vec_t cet_cs_vec_iso8859_1; -char *cet_str_iso8859_15_to_utf8(const char *src); -char *cet_str_utf8_to_iso8859_15(const char *src); +char* cet_str_iso8859_15_to_utf8(const char* src); +char* cet_str_utf8_to_iso8859_15(const char* src); extern const cet_cs_vec_t cet_cs_vec_iso8859_15; -char *cet_str_utf8_to_us_ascii(const char *src); -char *cet_str_us_ascii_to_utf8(const char *src); +char* cet_str_utf8_to_us_ascii(const char* src); +char* cet_str_us_ascii_to_utf8(const char* src); extern cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968; -short *cet_str_utf8_to_uni(const char *src, int *length); +short* cet_str_utf8_to_uni(const char* src, int* length); extern cet_cs_vec_t cet_cs_vec_utf8; @@ -96,27 +96,27 @@ extern cet_cs_vec_t cet_cs_vec_utf8; #endif /* not defined XMLCALL */ #if HAVE_LIBEXPAT -int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *encoding, XML_Encoding *info); +int XMLCALL cet_lib_expat_UnknownEncodingHandler(void* data, const XML_Char* encoding, XML_Encoding* info); #endif /* helpers */ -char *cet_str_uni_to_any(const short *src, int length, const cet_cs_vec_t *dest_vec); -char *cet_str_any_to_any(const char *src, const cet_cs_vec_t *src_vec, const cet_cs_vec_t *dest_vec); -int cet_valid_char(const char *src, const cet_cs_vec_t *vec); +char* cet_str_uni_to_any(const short* src, int length, const cet_cs_vec_t* dest_vec); +char* cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, const cet_cs_vec_t* dest_vec); +int cet_valid_char(const char* src, const cet_cs_vec_t* vec); -int cet_gbfprintf(gbfile *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...); +int cet_gbfprintf(gbfile* stream, const cet_cs_vec_t* src_vec, const char* fmt, ...); /* cet_convert_string: !!! ONLY VALID WITHIN 'cet_convert_strings' process !!! */ -char *cet_convert_string(char *str); +char* cet_convert_string(char* str); /* gpsbabel extensions */ -void cet_convert_init(const char *cs_name, const int force); -void cet_convert_strings(const cet_cs_vec_t *source, const cet_cs_vec_t *target, const char *format); +void cet_convert_init(const char* cs_name, const int force); +void cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, const char* format); void cet_convert_deinit(void); -void cet_disp_character_set_names(FILE *fout); +void cet_disp_character_set_names(FILE* fout); /* * Conversion from XML_Char string to char string. If XML_Char is the @@ -126,11 +126,11 @@ void cet_disp_character_set_names(FILE *fout); * it. */ -const char *xml_convert_to_char_string_n(const XML_Char *str, int *nbytes); -const char *xml_convert_to_char_string(const XML_Char *str); -void xml_free_converted_string(const char *str); +const char* xml_convert_to_char_string_n(const XML_Char* str, int* nbytes); +const char* xml_convert_to_char_string(const XML_Char* str); +void xml_free_converted_string(const char* str); -const char **xml_convert_attrs_to_char_string(const XML_Char **xml_attr); -void xml_free_converted_attrs(const char **attr); +const char** xml_convert_attrs_to_char_string(const XML_Char** xml_attr); +void xml_free_converted_attrs(const char** attr); #endif diff --git a/gpsbabel/cetus.c b/gpsbabel/cetus.c index 9ed243f46..a96e36d91 100644 --- a/gpsbabel/cetus.c +++ b/gpsbabel/cetus.c @@ -134,13 +134,13 @@ typedef struct cetus_track_point_s { #define TRACK_POINT_SIZE sizeof(struct cetus_track_point_s) -static pdbfile *file_in, *file_out; -static const char *out_fname; +static pdbfile* file_in, *file_out; +static const char* out_fname; static short_handle mkshort_wr_handle; static int ct; -static char *dbname = NULL; -static char *appendicon = NULL; +static char* dbname = NULL; +static char* appendicon = NULL; static arglist_t cetus_args[] = { @@ -155,11 +155,11 @@ arglist_t cetus_args[] = { ARG_TERMINATOR }; -static waypoint * -read_track_point(cetus_track_point_t *data, const time_t basetime) +static waypoint* +read_track_point(cetus_track_point_t* data, const time_t basetime) { int i, ilat, ilon; - waypoint *wpt; + waypoint* wpt; ilat = be_read32(&data->latitude); ilon = be_read32(&data->longitude); @@ -221,15 +221,15 @@ read_track_point(cetus_track_point_t *data, const time_t basetime) static void -read_tracks(const pdbfile *pdb) +read_tracks(const pdbfile* pdb) { - pdbrec_t *pdb_rec; + pdbrec_t* pdb_rec; int reclen, records, total, points, dropped; char descr[(2 * TRACK_POINT_SIZE) + 1]; char temp_descr[TRACK_POINT_SIZE + 1]; - cetus_track_head_t *head; - waypoint *wpt; - route_head *track; + cetus_track_head_t* head; + waypoint* wpt; + route_head* track; time_t basetime; track = route_head_alloc(); @@ -242,7 +242,7 @@ read_tracks(const pdbfile *pdb) for (pdb_rec = pdb->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { int i, magic; - char *c = (char *)pdb_rec->data; + char* c = (char*)pdb_rec->data; magic = be_read32(c); if (magic != MYTRACK) { @@ -259,7 +259,7 @@ read_tracks(const pdbfile *pdb) struct tm tm; case 0: /* track header */ - head = (cetus_track_head_t *)c; + head = (cetus_track_head_t*)c; if (head->id[0] != 'C' || head->id[1] != 'G') { fatal(MYNAME ": Invalid track header!\n"); } @@ -284,7 +284,7 @@ read_tracks(const pdbfile *pdb) break; default: - wpt = read_track_point((cetus_track_point_t *)c, basetime); + wpt = read_track_point((cetus_track_point_t*)c, basetime); if (wpt != NULL) { track_add_wpt(track, wpt); points++; @@ -305,19 +305,19 @@ read_tracks(const pdbfile *pdb) } static void -read_waypts(const pdbfile *pdb) +read_waypts(const pdbfile* pdb) { - struct cetus_wpt_s *rec; - pdbrec_t *pdb_rec; - char *vdata; + struct cetus_wpt_s* rec; + pdbrec_t* pdb_rec; + char* vdata; for (pdb_rec = pdb->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; int i; wpt_tmp = waypt_new(); - rec = (struct cetus_wpt_s *) pdb_rec->data; + rec = (struct cetus_wpt_s*) pdb_rec->data; if (be_read32(&rec->elevation) == -100000000) { wpt_tmp->altitude = unknown_alt; } else { @@ -373,7 +373,7 @@ read_waypts(const pdbfile *pdb) } - vdata = (char *) pdb_rec->data + sizeof(*rec); + vdata = (char*) pdb_rec->data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata = vdata + strlen(vdata) + 1; @@ -391,7 +391,7 @@ read_waypts(const pdbfile *pdb) /* --------------------------------------------------------------------------- */ static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -407,7 +407,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -444,15 +444,15 @@ data_read(void) static void -cetus_writewpt(const waypoint *wpt) +cetus_writewpt(const waypoint* wpt) { - struct cetus_wpt_s *rec; - struct tm *tm; - char *vdata; - char *desc_long; - char *desc_short; - char *desc_geo; - char *desc; + struct cetus_wpt_s* rec; + struct tm* tm; + char* vdata; + char* desc_long; + char* desc_short; + char* desc_geo; + char* desc; rec = (struct cetus_wpt_s*) xcalloc(sizeof(*rec)+18 + NOTESZ + DESCSZ,1); @@ -494,9 +494,9 @@ cetus_writewpt(const waypoint *wpt) rec->sat = wpt->sat ? wpt->sat : 0xff; - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); if (wpt->shortname) { - char *sn = xstrdup(wpt->shortname); + char* sn = xstrdup(wpt->shortname); strncpy(vdata, sn, 16); vdata[15] = '\0'; xfree(sn); @@ -521,7 +521,7 @@ cetus_writewpt(const waypoint *wpt) } if (wpt->gc_data->desc_short.utfstring) { - char *stripped_html = strip_html(&wpt->gc_data->desc_short); + char* stripped_html = strip_html(&wpt->gc_data->desc_short); desc_short = xstrdup(wpt->gc_data->diff == 0 ? "\n\n" : ""); desc_short = xstrappend(desc_short, xstrdup(stripped_html)); xfree(stripped_html); @@ -530,7 +530,7 @@ cetus_writewpt(const waypoint *wpt) } if (wpt->gc_data->desc_long.utfstring) { - char *stripped_html = strip_html(&wpt->gc_data->desc_long); + char* stripped_html = strip_html(&wpt->gc_data->desc_long); desc_long = xstrdup("\n\n"); desc_long = xstrappend(desc_long, xstrdup(stripped_html)); xfree(stripped_html); @@ -564,7 +564,7 @@ cetus_writewpt(const waypoint *wpt) vdata += strlen(vdata) + 1; if (wpt->gc_data->hint) { - char *hint = xstrdup(wpt->gc_data->hint); + char* hint = xstrdup(wpt->gc_data->hint); rec->type = WptCache; strncpy(vdata, hint, NOTESZ + 1) ; xfree(hint); @@ -575,22 +575,22 @@ cetus_writewpt(const waypoint *wpt) } vdata += strlen(vdata) + 1; - pdb_write_rec(file_out, 0, 2, ct++, rec, (char *)vdata - (char *)rec); + pdb_write_rec(file_out, 0, 2, ct++, rec, (char*)vdata - (char*)rec); xfree(rec); } struct hdr { - char *wpt_name; - waypoint *wpt; + char* wpt_name; + waypoint* wpt; }; static int -compare(const void *a, const void *b) +compare(const void* a, const void* b) { - const struct hdr *wa = (const struct hdr*) a; - const struct hdr *wb = (const struct hdr*) b; + const struct hdr* wa = (const struct hdr*) a; + const struct hdr* wb = (const struct hdr*) b; return strcmp(wa->wpt->shortname, wb->wpt->shortname); } @@ -599,10 +599,10 @@ static void data_write(void) { int i, ct = waypt_count(); - struct hdr *htable, *bh; - queue *elem, *tmp; + struct hdr* htable, *bh; + queue* elem, *tmp; extern queue waypt_head; - waypoint *waypointp; + waypoint* waypointp; mkshort_wr_handle = mkshort_new_handle(); setshort_length(mkshort_wr_handle, 15); setshort_whitespace_ok(mkshort_wr_handle, 0); @@ -628,7 +628,7 @@ data_write(void) bh = htable; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; bh->wpt = waypointp; if (global_opts.synthesize_shortnames && waypointp->description) { if (waypointp->shortname) { diff --git a/gpsbabel/coastexp.c b/gpsbabel/coastexp.c index ff5fd3677..6ff0420df 100755 --- a/gpsbabel/coastexp.c +++ b/gpsbabel/coastexp.c @@ -30,7 +30,7 @@ static XML_Parser psr; #include "uuid.h" -static gbfile *fd, *ofd; +static gbfile* fd, *ofd; #define MYNAME "coastexp" #define MY_CBUF 4096 @@ -39,15 +39,15 @@ static gbfile *fd, *ofd; #define MY_XBUF 128 -static char *element; // Current element being parsed -static char *cdatastr; // Current XML character data being built up (until a ) +static char* element; // Current element being parsed +static char* cdatastr; // Current XML character data being built up (until a ) /* CE-specific mark structure - used for both route marks and standalone marks */ struct CE_MARK { queue Q; - char *id; // CE's mark ID (of the form "{}") - char *created; // CE's creation time (of the form "
TZ") - waypoint *wp; // GPSBabel waypoint + char* id; // CE's mark ID (of the form "{}") + char* created; // CE's creation time (of the form "
TZ") + waypoint* wp; // GPSBabel waypoint int used; // Is this mark used in a route or not? }; typedef struct CE_MARK ce_mark; @@ -55,46 +55,46 @@ typedef struct CE_MARK ce_mark; /* CE-specific route structure */ struct CE_ROUTE { queue Q; - char *id; // CE's route ID (of the form "{}") - route_head *r; // GPSBabel route header + char* id; // CE's route ID (of the form "{}") + route_head* r; // GPSBabel route header queue ce_mark_head; // list of CE marks in this route }; typedef struct CE_ROUTE ce_route; static queue ce_route_head; // List of routes currently found -static ce_route *currentRoute = NULL; // Current route being processed +static ce_route* currentRoute = NULL; // Current route being processed static queue ce_mark_head; // List of stand-alone marks currently found -static ce_mark *currentMark = NULL; // Current mark being processed -static char *time_buffer = NULL; // Time buffer for processing times -static char *uuid_buffer = NULL; // UUID buffer for processing uuid's -static char *xml_buffer = NULL; // XML buffer for processing XML strings +static ce_mark* currentMark = NULL; // Current mark being processed +static char* time_buffer = NULL; // Time buffer for processing times +static char* uuid_buffer = NULL; // UUID buffer for processing uuid's +static char* xml_buffer = NULL; // XML buffer for processing XML strings static int inRoute = 0; // Are we processing a route? static int inMark = 0; // Are we processing a mark? /* Add a route to the list of routes */ static void -ce_add_route(ce_route *route) +ce_add_route(ce_route* route) { ENQUEUE_TAIL(&ce_route_head, &route->Q); } /* Add a mark to the list of stand-alone marks */ static void -ce_add_mark(ce_mark *mark) +ce_add_mark(ce_mark* mark) { ENQUEUE_TAIL(&ce_mark_head, &mark->Q); } /* Add a mark to the specified route */ static void -ce_add_mark_to_route(ce_route *route, ce_mark *mark) +ce_add_mark_to_route(ce_route* route, ce_mark* mark) { ENQUEUE_TAIL(&route->ce_mark_head, &mark->Q); } /* Free a mark */ static void -ce_free_mark(ce_mark *mark) +ce_free_mark(ce_mark* mark) { dequeue(&mark->Q); if (mark->id) { @@ -108,11 +108,11 @@ ce_free_mark(ce_mark *mark) /* Free a route */ static void -ce_free_route(ce_route *route) +ce_free_route(ce_route* route) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&route->ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; ce_free_mark(mark); } xfree(route->id); @@ -121,18 +121,18 @@ ce_free_route(ce_route *route) } /* Allocate a mark */ -static ce_mark * -ce_alloc_mark(const waypoint *wpt, const char *id) +static ce_mark* +ce_alloc_mark(const waypoint* wpt, const char* id) { - ce_mark *res = xcalloc(sizeof(ce_mark), 1); - res->id = (char *) id; - res->wp = (waypoint *) wpt; + ce_mark* res = (ce_mark*) xcalloc(sizeof(ce_mark), 1); + res->id = (char*) id; + res->wp = (waypoint*) wpt; return res; } #if !HAVE_LIBEXPAT void -ce_rd_init(const char *fname) +ce_rd_init(const char* fname) { fatal(MYNAME ": This build excluded CoastalExplorer support because expat was not installed.\n"); } @@ -145,11 +145,11 @@ ce_read(void) /* Start processing an XML item */ static void -ce_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) +ce_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) { - const char *el = xml_convert_to_char_string(xml_el); - const char **ap; - const char **attr; + const char* el = xml_convert_to_char_string(xml_el); + const char** ap; + const char** attr; attr = xml_convert_attrs_to_char_string(xml_attr); strcpy(element, el); @@ -158,7 +158,7 @@ ce_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) for (ap = attr; *ap; ap+=2) { if (0 == strcmp(ap[0], "id")) { // Create a CE route object and add it to the list of routes - currentRoute = (ce_route *) xcalloc(sizeof(ce_route), 1); + currentRoute = (ce_route*) xcalloc(sizeof(ce_route), 1); currentRoute->id=xstrdup(ap[1]); currentRoute->r = route_head_alloc(); QUEUE_INIT(¤tRoute->ce_mark_head); @@ -184,9 +184,9 @@ ce_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) /* Finish processing an XML item */ static void -ce_end(void *data, const XML_Char *xml_el) +ce_end(void* data, const XML_Char* xml_el) { - const char *el = xml_convert_to_char_string(xml_el); + const char* el = xml_convert_to_char_string(xml_el); if (0 == strcmp(el, "Route")) { inRoute = 0; /* ??? */ } else if (0 == strcmp(el, "Mark")) { @@ -197,12 +197,12 @@ ce_end(void *data, const XML_Char *xml_el) /* Process some XML character data for the current item */ static void -ce_cdata(void *dta, const XML_Char *xml_s, int len) +ce_cdata(void* dta, const XML_Char* xml_s, int len) { - const char *origs = xml_convert_to_char_string_n(xml_s, &len); - const char *s = origs; + const char* origs = xml_convert_to_char_string_n(xml_s, &len); + const char* s = origs; if (*s != '\n') { - char *edatastr; + char* edatastr; // We buffer up characters in 'cdatastr' until a single is received if ((strlen(cdatastr) + len) > MY_CBUF) { printf("Buffer overflow - line too long!"); @@ -224,18 +224,18 @@ ce_cdata(void *dta, const XML_Char *xml_s, int len) if (inRoute) { // We are processing the marks in a route so create a CE mark object // and add it to the current route - ce_mark *mark = (ce_mark *) ce_alloc_mark(NULL, xstrdup(s)); + ce_mark* mark = (ce_mark*) ce_alloc_mark(NULL, xstrdup(s)); ce_add_mark_to_route(currentRoute, mark); } } else if (0 == strcmp(element, "Position")) { if (inMark) { // We are processing a standalone mark so read the lat/long position // and create a waypoint to add to the current mark - char *position = xstrdup(s); - char *lat = position; - char *latNorS = position; - char *lng; - char *longEorW; + char* position = xstrdup(s); + char* lat = position; + char* latNorS = position; + char* lng; + char* longEorW; while (*latNorS != ' ') { latNorS++; } @@ -299,7 +299,7 @@ ce_cdata(void *dta, const XML_Char *xml_s, int len) } } else if (0 == strcmp(element, "Description")) { // Descriptions we care about may be either for routes or marks - char *desc = xstrdup(s); + char* desc = xstrdup(s); if (inMark) { if (!currentMark->wp) { currentMark->wp = waypt_new(); @@ -319,7 +319,7 @@ ce_cdata(void *dta, const XML_Char *xml_s, int len) /* Set up reading the CE input file */ void -ce_rd_init(const char *fname) +ce_rd_init(const char* fname) { fd = gbfopen(fname, "r", MYNAME); QUEUE_INIT(&ce_route_head); @@ -332,8 +332,8 @@ ce_rd_init(const char *fname) XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); XML_SetElementHandler(psr, ce_start, ce_end); - cdatastr = xcalloc(MY_CBUF,1); - element = xcalloc(MY_CBUF,1); + cdatastr = (char*) xcalloc(MY_CBUF,1); + element = (char*) xcalloc(MY_CBUF,1); XML_SetCharacterDataHandler(psr, ce_cdata); } @@ -362,15 +362,15 @@ ce_read(void) void ce_fix_route_mark_waypoints(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route *route = (ce_route *) elem; - queue *elem2, *tmp2; + ce_route* route = (ce_route*) elem; + queue* elem2, *tmp2; QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark *mark = (ce_mark *) elem2; - queue *elem3, *tmp3; + ce_mark* mark = (ce_mark*) elem2; + queue* elem3, *tmp3; QUEUE_FOR_EACH(&ce_mark_head, elem3, tmp3) { - ce_mark *mark2 = (ce_mark *) elem3; + ce_mark* mark2 = (ce_mark*) elem3; if (0 == strcmp(mark->id, mark2->id)) { mark->wp = waypt_dupe(mark2->wp); mark2->used = 1; @@ -385,14 +385,14 @@ ce_fix_route_mark_waypoints(void) void ce_check_route_names(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route *route = (ce_route *) elem; + ce_route* route = (ce_route*) elem; if (route->r->rte_name == NULL) { *cdatastr = '\0'; - strcat(cdatastr, ((ce_mark *) QUEUE_FIRST(&route->ce_mark_head))->wp->shortname); + strcat(cdatastr, ((ce_mark*) QUEUE_FIRST(&route->ce_mark_head))->wp->shortname); strcat(cdatastr, "->"); - strcat(cdatastr, ((ce_mark *) QUEUE_LAST(&route->ce_mark_head))->wp->shortname); + strcat(cdatastr, ((ce_mark*) QUEUE_LAST(&route->ce_mark_head))->wp->shortname); route->r->rte_name = xstrdup(cdatastr); } } @@ -402,9 +402,9 @@ ce_check_route_names(void) void ce_remove_used_marks(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; if (mark->used) { if (mark->wp) { waypt_free(mark->wp); @@ -418,13 +418,13 @@ ce_remove_used_marks(void) void ce_print_results(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - queue *elem2, *tmp2; - ce_route *route = (ce_route *) elem; + queue* elem2, *tmp2; + ce_route* route = (ce_route*) elem; printf("Route name=%s id=%s\n", route->r->rte_name, route->id); QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark *mark = (ce_mark *) elem2; + ce_mark* mark = (ce_mark*) elem2; if (mark->wp == NULL) { printf(" null\n"); } else { @@ -434,7 +434,7 @@ ce_print_results(void) } QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; printf("Mark name=%s id=%s ", mark->wp->shortname, mark->id); if (mark->wp == NULL) { printf("(null)\n"); @@ -453,7 +453,7 @@ ce_rd_deinit(void) If doing waypoints, we create only waypoint structures for both route waypoints and standalone waypoints. */ - queue *elem, *tmp; + queue* elem, *tmp; ce_fix_route_mark_waypoints(); ce_check_route_names(); @@ -466,11 +466,11 @@ ce_rd_deinit(void) // Add routes to GPSBabel QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route *route = (ce_route *) elem; - queue *elem2, *tmp2; + ce_route* route = (ce_route*) elem; + queue* elem2, *tmp2; route_add_head(route->r); QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark *mark = (ce_mark *) elem2; + ce_mark* mark = (ce_mark*) elem2; if (mark->wp) { route_add_wpt(route->r, mark->wp); } else { @@ -482,7 +482,7 @@ ce_rd_deinit(void) // Add (unused) marks to GPSBabel QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; waypt_add(mark->wp); ce_free_mark(mark); } @@ -494,14 +494,14 @@ ce_rd_deinit(void) /* Setup for writing */ void -ce_wr_init(const char *fname) +ce_wr_init(const char* fname) { QUEUE_INIT(&ce_mark_head); // Alloocate all buffers used for writing - time_buffer = xcalloc(MY_TBUF,1); - uuid_buffer = xcalloc(MY_UBUF,1); - xml_buffer = xcalloc(MY_XBUF, 1); + time_buffer = (char*) xcalloc(MY_TBUF,1); + uuid_buffer = (char*) xcalloc(MY_UBUF,1); + xml_buffer = (char*) xcalloc(MY_XBUF, 1); ofd = gbfopen(fname, "w", MYNAME); srand(gpsbabel_now); @@ -519,7 +519,7 @@ ce_wr_deinit(void) } /* Generate a CE-style creation time based on supplied time */ -static char * +static char* ce_gen_creation_time(time_t tm) { xml_fill_in_time(time_buffer, tm, 0, XML_SHORT_TIME); @@ -527,14 +527,14 @@ ce_gen_creation_time(time_t tm) } /* Generate a CE-style creation time based on current time */ -static char * +static char* ce_gen_current_time(void) { return ce_gen_creation_time(current_time()); } /* Generate a UUID (has same format as Microsoft registry GUIDs */ -static char * +static char* ce_gen_uuid(void) { uuid_t uu; @@ -549,7 +549,7 @@ ce_gen_uuid(void) /* Generate route header XML */ static void -ce_route_hdr(const route_head *rte) +ce_route_hdr(const route_head* rte) { sprintf(xml_buffer, "{%s}", ce_gen_uuid()); write_xml_entity_begin2(ofd, "\t", "Route", "created", ce_gen_current_time(), "id", xml_buffer); @@ -558,10 +558,10 @@ ce_route_hdr(const route_head *rte) /* Generate route body XML */ static void -ce_route_disp(const waypoint *waypointp) +ce_route_disp(const waypoint* waypointp) { - char *uuid = ce_gen_uuid(); - char *id = xcalloc(strlen(uuid)+3, 1); + char* uuid = ce_gen_uuid(); + char* id = (char*) xcalloc(strlen(uuid)+3, 1); sprintf(id, "{%s}", uuid); currentMark = ce_alloc_mark(waypointp, id); @@ -572,7 +572,7 @@ ce_route_disp(const waypoint *waypointp) /* Generate route trailer XML */ static void -ce_route_tlr(const route_head *rte) +ce_route_tlr(const route_head* rte) { write_xml_entity_end(ofd, "\t\t", "Marks"); write_optional_xml_entity(ofd, "\t\t", "Name", rte->rte_name); @@ -581,7 +581,7 @@ ce_route_tlr(const route_head *rte) /* Generate waypoint body XML */ static void -ce_waypt_pr(const waypoint *wp) +ce_waypt_pr(const waypoint* wp) { double latitude = wp->latitude; char NorS = 'N'; @@ -605,13 +605,13 @@ ce_waypt_pr(const waypoint *wp) } } -static char * -ce_find_uuid(const waypoint *wpt) +static char* +ce_find_uuid(const waypoint* wpt) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; if (mark->wp == wpt) { return mark->id; } @@ -619,13 +619,13 @@ ce_find_uuid(const waypoint *wpt) return NULL; } -static waypoint * -ce_find_wpt(const waypoint *wpt) +static waypoint* +ce_find_wpt(const waypoint* wpt) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; if ((mark->wp->shortname == wpt->shortname) && (mark->wp->latitude == wpt->latitude) && (mark->wp->longitude == wpt->longitude)) { @@ -637,9 +637,9 @@ ce_find_wpt(const waypoint *wpt) /* Generate a mark XML; look for created id's */ static void -ce_mark_pr(const waypoint *wp) +ce_mark_pr(const waypoint* wp) { - char *id; + char* id; if (inRoute) { id = ce_find_uuid(wp); @@ -652,7 +652,7 @@ ce_mark_pr(const waypoint *wp) else if (ce_find_wpt(wp) != NULL) { return; } else { - ce_mark *mark = ce_alloc_mark(wp, NULL); + ce_mark* mark = ce_alloc_mark(wp, NULL); ENQUEUE_TAIL(&ce_mark_head, &mark->Q); sprintf(xml_buffer, "{%s}", ce_gen_uuid()); id = xml_buffer; @@ -668,10 +668,10 @@ ce_mark_pr(const waypoint *wp) static void ce_marks_pr(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; ce_mark_pr(mark->wp); } } @@ -680,10 +680,10 @@ ce_marks_pr(void) static void ce_marks_flush_all(void) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark *mark = (ce_mark *) elem; + ce_mark* mark = (ce_mark*) elem; ce_free_mark(mark); } } @@ -717,7 +717,7 @@ ce_write(void) ff_vecs_t coastexp_vecs = { ff_type_file, - { ff_cap_read|ff_cap_write, ff_cap_none, ff_cap_read|ff_cap_write }, + { (ff_cap)(ff_cap_read|ff_cap_write), ff_cap_none, (ff_cap)(ff_cap_read|ff_cap_write) }, ce_rd_init, ce_wr_init, ce_rd_deinit, diff --git a/gpsbabel/compegps.c b/gpsbabel/compegps.c index 0f8d20b76..1ff184f60 100644 --- a/gpsbabel/compegps.c +++ b/gpsbabel/compegps.c @@ -71,7 +71,7 @@ #define SHORT_NAME_LENGTH 16 -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int target_index, curr_index; static int track_info_flag; static short_handle sh; @@ -79,15 +79,15 @@ static int snlen; static int radius; static int input_datum; -static route_head *curr_track; -static route_head *curr_route; +static route_head* curr_track; +static route_head* curr_route; /* placeholders for options */ -static char *option_icon; -static char *option_index; -static char *option_radius; -static char *option_snlen; +static char* option_icon; +static char* option_index; +static char* option_radius; +static char* option_snlen; static arglist_t compegps_args[] = { @@ -111,7 +111,7 @@ arglist_t compegps_args[] = { }; static -void fix_datum(double *lat, double *lon) +void fix_datum(double* lat, double* lon) { double amt; @@ -125,7 +125,7 @@ void fix_datum(double *lat, double *lon) } static void -compegps_parse_date(const char *c, struct tm* tm) +compegps_parse_date(const char* c, struct tm* tm) { char month[4]; int year; @@ -145,7 +145,7 @@ compegps_parse_date(const char *c, struct tm* tm) } static void -compegps_parse_time(const char *c, struct tm* tm) +compegps_parse_time(const char* c, struct tm* tm) { tm->tm_hour = atoi(c); tm->tm_min = atoi(c+3); @@ -155,11 +155,11 @@ compegps_parse_time(const char *c, struct tm* tm) /* specialized readers */ static waypoint* -parse_wpt(char *buff) +parse_wpt(char* buff) { int col = -1; - char *c, *cx; - waypoint *wpt = waypt_new(); + char* c, *cx; + waypoint* wpt = waypt_new(); struct tm tm; int has_time = 0; memset(&tm, 0, sizeof(tm)); @@ -228,9 +228,9 @@ parse_wpt(char *buff) } static void -parse_wpt_info(const char *buff, waypoint *wpt) /* "w" */ +parse_wpt_info(const char* buff, waypoint* wpt) /* "w" */ { - char *c; + char* c; int col = -1; double fx; @@ -272,13 +272,13 @@ parse_wpt_info(const char *buff, waypoint *wpt) /* "w" */ } } -static waypoint * -parse_trkpt(char *buff) +static waypoint* +parse_trkpt(char* buff) { int col = -1; - char *c; + char* c; struct tm tm; - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); c = strstr(buff, "A "); if (c == buff) { @@ -319,9 +319,9 @@ parse_trkpt(char *buff) } static void -parse_track_info(const char *buff, route_head *track) /* "t" */ +parse_track_info(const char* buff, route_head* track) /* "t" */ { - char *c; + char* c; int col = -1; c = csv_lineparse(buff, "|", "", col++); @@ -348,9 +348,9 @@ parse_track_info(const char *buff, route_head *track) /* "t" */ } static void -parse_rte_info(const char *buff, route_head *route) /* "R" */ +parse_rte_info(const char* buff, route_head* route) /* "R" */ { - char *c; + char* c; int col = -1; c = csv_lineparse(buff, ",", "", col++); @@ -378,7 +378,7 @@ parse_rte_info(const char *buff, route_head *route) /* "R" */ /* main functions */ static void -compegps_rd_init(const char *fname) +compegps_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); input_datum = DATUM_WGS84; @@ -393,16 +393,16 @@ compegps_rd_deinit(void) static void compegps_data_read(void) { - char *buff; + char* buff; int line = 0; int input_datum; - waypoint *wpt = NULL; - route_head *route = NULL; - route_head *track = NULL; + waypoint* wpt = NULL; + route_head* route = NULL; + route_head* track = NULL; while ((buff = gbfgetstr(fin))) { - char *cin = buff; - char *ctail; + char* cin = buff; + char* ctail; if ((line++ == 0) && fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -478,9 +478,9 @@ compegps_data_read(void) /* ----------------------------------------------------------- */ static void -write_waypt_cb(const waypoint *wpt) +write_waypt_cb(const waypoint* wpt) { - char *name; + char* name; if (curr_index != target_index) { return; @@ -502,10 +502,10 @@ write_waypt_cb(const waypoint *wpt) if ((wpt->icon_descr != NULL) || (wpt->wpt_flags.proximity) || \ (option_icon != NULL)) { - char *icon = option_icon; + char* icon = option_icon; if (wpt->icon_descr != NULL) { - icon = (char *) wpt->icon_descr; + icon = (char*) wpt->icon_descr; } gbfprintf(fout, "w %s,0,0.0,16777215,255,1,7,,%.1f\n", @@ -516,10 +516,10 @@ write_waypt_cb(const waypoint *wpt) } static void -write_route_hdr_cb(const route_head *rte) +write_route_hdr_cb(const route_head* rte) { - char *name; - curr_route = (route_head *) rte; + char* name; + curr_route = (route_head*) rte; curr_index++; if (curr_index != target_index) { return; @@ -543,10 +543,10 @@ write_route(void) } static void -write_track_hdr_cb(const route_head *trk) +write_track_hdr_cb(const route_head* trk) { track_info_flag = 0; - curr_track = (route_head *) trk; + curr_track = (route_head*) trk; curr_index++; if (curr_index != target_index) { @@ -557,7 +557,7 @@ write_track_hdr_cb(const route_head *trk) } static void -write_trkpt_cb(const waypoint *wpt) +write_trkpt_cb(const waypoint* wpt) { char buff[128]; struct tm tm; @@ -595,7 +595,7 @@ write_trkpt_cb(const waypoint *wpt) if (track_info_flag != 0) { track_info_flag = 0; if (curr_track->rte_name != NULL) { - char *name; + char* name; name = csv_stringclean(curr_track->rte_name, "|"); gbfprintf(fout, "t 4294967295|%s|-1|-1\n", name); @@ -623,7 +623,7 @@ write_waypoints(void) /* --------------------------------------------------------------------------- */ static void -compegps_wr_init(const char *fname) +compegps_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); sh = mkshort_new_handle(); diff --git a/gpsbabel/copilot.c b/gpsbabel/copilot.c index 2438471e5..93c589e0c 100644 --- a/gpsbabel/copilot.c +++ b/gpsbabel/copilot.c @@ -61,12 +61,12 @@ struct record4 { pdb_float elevation; /* feet */ }; -static pdbfile *file_in, *file_out; -static const char *out_fname; +static pdbfile* file_in, *file_out; +static const char* out_fname; static int ct; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -78,7 +78,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -92,10 +92,10 @@ wr_deinit(void) } static waypoint* -read_version0(void *data) +read_version0(void* data) { - char *vdata; - waypoint *wpt_tmp; + char* vdata; + waypoint* wpt_tmp; struct record0* rec = (struct record0*)data; wpt_tmp = waypt_new(); @@ -106,7 +106,7 @@ read_version0(void *data) DEG(pdb_read_double(&rec->latitude)); wpt_tmp->altitude = FEET_TO_METERS(be_read32(&rec->elevation)); - vdata = (char *) data + sizeof(*rec); + vdata = (char*) data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata = vdata + strlen(vdata) + 1; @@ -120,10 +120,10 @@ read_version0(void *data) } static waypoint* -read_version1(void *data) +read_version1(void* data) { - char *vdata; - waypoint *wpt_tmp; + char* vdata; + waypoint* wpt_tmp; struct record1* rec = (struct record1*)data; wpt_tmp = waypt_new(); @@ -135,7 +135,7 @@ read_version1(void *data) wpt_tmp->altitude = FEET_TO_METERS(pdb_read_double(&rec->elevation)); - vdata = (char *) data + sizeof(*rec); + vdata = (char*) data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata = vdata + strlen(vdata) + 1; @@ -149,10 +149,10 @@ read_version1(void *data) } static waypoint* -read_version3(void *data) +read_version3(void* data) { - char *vdata; - waypoint *wpt_tmp; + char* vdata; + waypoint* wpt_tmp; struct record3* rec = (struct record3*)data; wpt_tmp = waypt_new(); @@ -164,7 +164,7 @@ read_version3(void *data) wpt_tmp->altitude = FEET_TO_METERS(pdb_read_double(&rec->elevation)); - vdata = (char *) data + sizeof(*rec); + vdata = (char*) data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata = vdata + strlen(vdata) + 1; @@ -178,10 +178,10 @@ read_version3(void *data) } static waypoint* -read_version4(void *data) +read_version4(void* data) { - char *vdata; - waypoint *wpt_tmp; + char* vdata; + waypoint* wpt_tmp; struct record4* rec = (struct record4*)data; wpt_tmp = waypt_new(); @@ -193,7 +193,7 @@ read_version4(void *data) wpt_tmp->altitude = FEET_TO_METERS(pdb_read_float(&rec->elevation)); - vdata = (char *) data + sizeof(*rec); + vdata = (char*) data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata = vdata + strlen(vdata) + 1; @@ -209,7 +209,7 @@ read_version4(void *data) static void data_read(void) { - pdbrec_t *pdb_rec; + pdbrec_t* pdb_rec; if ((file_in->creator != GXPU_CREATOR && file_in->creator != AP_P_CREATOR) || (file_in->type != wayp_TYPE && file_in->type != swpu_TYPE && @@ -222,7 +222,7 @@ data_read(void) for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; switch (file_in->version) { case 0: @@ -246,12 +246,12 @@ data_read(void) } static void -copilot_writewpt(const waypoint *wpt) +copilot_writewpt(const waypoint* wpt) { - struct record4 *rec; - char *vdata; + struct record4* rec; + char* vdata; - rec = (struct record4 *) xcalloc(sizeof(*rec)+1141,1); + rec = (struct record4*) xcalloc(sizeof(*rec)+1141,1); pdb_write_double(&rec->latitude, RAD(wpt->latitude)); pdb_write_double(&rec->longitude, RAD(-wpt->longitude)); @@ -259,7 +259,7 @@ copilot_writewpt(const waypoint *wpt) pdb_write_float(&rec->elevation, METERS_TO_FEET(wpt->altitude)); - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); if (wpt->shortname) { strncpy(vdata, wpt->shortname, 10); vdata[9] = '\0'; @@ -283,7 +283,7 @@ copilot_writewpt(const waypoint *wpt) } vdata += strlen(vdata) + 1; - pdb_write_rec(file_out, 0, 2, ct++, rec, (char *)vdata - (char *)rec); + pdb_write_rec(file_out, 0, 2, ct++, rec, (char*)vdata - (char*)rec); xfree(rec); } diff --git a/gpsbabel/coto.c b/gpsbabel/coto.c index a4c3e705a..1219335ba 100644 --- a/gpsbabel/coto.c +++ b/gpsbabel/coto.c @@ -92,14 +92,14 @@ typedef struct appinfo { #define APPINFO_SIZE sizeof(appinfo_t) -static pdbfile *file_in, *file_out; -static const char *out_fname; -static const char *in_fname; /* We might need that for naming tracks */ +static pdbfile* file_in, *file_out; +static const char* out_fname; +static const char* in_fname; /* We might need that for naming tracks */ static short_handle mkshort_wr_handle; static int ct; -static char *zerocat = NULL; -static char *internals = NULL; +static char* zerocat = NULL; +static char* internals = NULL; static arglist_t coto_args[] = { @@ -115,7 +115,7 @@ arglist_t coto_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); in_fname = fname; @@ -128,7 +128,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -143,8 +143,8 @@ wr_deinit(void) /* helpers */ -static char * -coto_get_icon_descr(int category, const appinfo_t *app) +static char* +coto_get_icon_descr(int category, const appinfo_t* app) { char buff[CATEGORY_NAME_LENGTH + 1] = "Not Assigned"; if ((category >= 0) && (category < 16)) { @@ -163,10 +163,10 @@ coto_get_icon_descr(int category, const appinfo_t *app) static void coto_track_read(void) { - struct record_track *rec; - pdbrec_t *pdb_rec; - route_head *trk_head; - char *track_name; + struct record_track* rec; + pdbrec_t* pdb_rec; + route_head* trk_head; + char* track_name; if (strncmp(file_in->name, "cotoGPS TrackDB", PDB_DBNAMELEN) != 0) // Use database name if not default @@ -174,7 +174,7 @@ coto_track_read(void) track_name = xstrndup(file_in->name, PDB_DBNAMELEN); } else { // Use filename for new track title - const char *fnametmp = strrchr(in_fname, '/'); + const char* fnametmp = strrchr(in_fname, '/'); if (fnametmp == NULL) { fnametmp = strrchr(in_fname, '\\'); } @@ -196,11 +196,11 @@ coto_track_read(void) trk_head->rte_name = track_name; for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; wpt_tmp = waypt_new(); - rec = (struct record_track *) pdb_rec->data; + rec = (struct record_track*) pdb_rec->data; wpt_tmp->longitude = DEG(-pdb_read_double(&rec->longitude)); wpt_tmp->latitude = DEG(pdb_read_double(&rec->latitude)); @@ -211,7 +211,7 @@ coto_track_read(void) if (internals) { // Parse the option as xcsv delimiter - const char *inter = xcsv_get_char_from_constant_table(internals); + const char* inter = xcsv_get_char_from_constant_table(internals); char temp[256]; snprintf(temp, sizeof(temp), "%.20f%s%.20f%s%.20f%s%.20f", pdb_read_double(&rec->distance), inter, pdb_read_double(&rec->arc), inter, pdb_read_double(&rec->x), inter, pdb_read_double(&rec->y)); @@ -252,18 +252,18 @@ coto_track_read(void) static void coto_wpt_read(void) { - struct record_wpt *rec; - pdbrec_t *pdb_rec; - appinfo_t *app; - app = (struct appinfo *) file_in->appinfo; + struct record_wpt* rec; + pdbrec_t* pdb_rec; + appinfo_t* app; + app = (struct appinfo*) file_in->appinfo; for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; - char *c; + waypoint* wpt_tmp; + char* c; wpt_tmp = waypt_new(); - rec = (struct record_wpt *) pdb_rec->data; + rec = (struct record_wpt*) pdb_rec->data; wpt_tmp->longitude = DEG(-pdb_read_double(&rec->lon)); wpt_tmp->latitude = DEG(pdb_read_double(&rec->lat)); @@ -312,7 +312,7 @@ data_read(void) static void coto_prepare_wpt_write(void) { - struct appinfo *ai; + struct appinfo* ai; file_out->name[PDB_DBNAMELEN-1] = 0; file_out->attr = PDB_FLAG_BACKUP; @@ -325,7 +325,7 @@ coto_prepare_wpt_write(void) file_out->appinfo_len = APPINFO_SIZE; file_out->appinfo = calloc(APPINFO_SIZE,1); - ai = (struct appinfo *) file_out->appinfo; + ai = (struct appinfo*) file_out->appinfo; be_write16(&ai->renamedCategories, 31); // Don't ask me why... if (zerocat) { strncpy(ai->categories[0], zerocat, 16); @@ -336,12 +336,12 @@ coto_prepare_wpt_write(void) } static void -coto_wpt_write(const waypoint *wpt) +coto_wpt_write(const waypoint* wpt) { - struct record_wpt *rec; - struct appinfo *ai = (struct appinfo *) file_out->appinfo; - char *notes = NULL; - char *shortname = NULL; + struct record_wpt* rec; + struct appinfo* ai = (struct appinfo*) file_out->appinfo; + char* notes = NULL; + char* shortname = NULL; int size; gbuint8 cat = 0; int i; @@ -401,7 +401,7 @@ coto_wpt_write(const waypoint *wpt) } } - pdb_write_rec(file_out, 0, cat, ct++, (const gbuint8 *)rec, size); + pdb_write_rec(file_out, 0, cat, ct++, (const gbuint8*)rec, size); xfree(shortname); xfree(rec); diff --git a/gpsbabel/cst.c b/gpsbabel/cst.c index ad59bcda9..ffe89401a 100644 --- a/gpsbabel/cst.c +++ b/gpsbabel/cst.c @@ -38,9 +38,9 @@ #define CST_REFERENCE 4 #define CST_VERSION 5 -static gbfile *fin; +static gbfile* fin; -static route_head *temp_route; +static route_head* temp_route; /* placeholders for options */ @@ -52,7 +52,7 @@ arglist_t cst_args[] = { /* helpers */ static void -cst_add_wpt(const route_head *track, waypoint *wpt) +cst_add_wpt(const route_head* track, waypoint* wpt) { if ((wpt == NULL) || (track == NULL)) { return; @@ -71,14 +71,14 @@ cst_add_wpt(const route_head *track, waypoint *wpt) } route_add_wpt(temp_route, waypt_dupe(wpt)); } - track_add_wpt((route_head *)track, (waypoint *)wpt); + track_add_wpt((route_head*)track, (waypoint*)wpt); } -static char * -cst_make_url(char *str) +static char* +cst_make_url(char* str) { int len = strlen(str); - char *res; + char* res; if (len < 3) { return NULL; @@ -92,7 +92,7 @@ cst_make_url(char *str) res[8] = *str++; res = xstrappend(res, str); { - char *c; + char* c; int i; c = res; /* replace all backslashes with a slash */ @@ -108,10 +108,10 @@ cst_make_url(char *str) } if (i > 0) { /* .. and replace them with "%20" */ - char *src, *dest, *last; + char* src, *dest, *last; last = src = res; - res = dest = xcalloc(strlen(src) + (2*i) + 1, 1); + res = dest = (char*) xcalloc(strlen(src) + (2*i) + 1, 1); while ((c = strchr(src, ' '))) { if (c != src) { strncpy(dest, src, c - src); @@ -138,7 +138,7 @@ cst_make_url(char *str) /* --------------------------------------------------------------------------- */ static void -cst_rd_init(const char *fname) +cst_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); temp_route = NULL; @@ -155,7 +155,7 @@ cst_rd_deinit(void) static void cst_data_read(void) { - char *buff; + char* buff; int line = 0; int data_lines = -1; int line_of_count = -1; @@ -163,11 +163,11 @@ cst_data_read(void) int section = CST_UNKNOWN; int cst_version; int cst_points = -1; - route_head *track = NULL; - waypoint *wpt = NULL; + route_head* track = NULL; + waypoint* wpt = NULL; while ((buff = gbfgetstr(fin))) { - char *cin = buff; + char* cin = buff; if ((line++ == 0) && fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -245,7 +245,7 @@ cst_data_read(void) } else { int interp, i; char name[256]; - char *pow; + char* pow; if (data_lines < 0) { if ((2 != sscanf(cin, "%d %128s", &i, name)) || @@ -278,7 +278,7 @@ cst_data_read(void) track = route_head_alloc(); track_add_head(track); } else if (strncmp(name, "NAME:", 5) == 0) { - wpt->shortname = xstrdup(((char *)&name) + 5); + wpt->shortname = xstrdup(((char*)&name) + 5); } pow = strrchr(cin, '^'); @@ -324,7 +324,7 @@ cst_data_read(void) #if 0 static void -cst_wr_init(const char *fname) +cst_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); } @@ -336,17 +336,17 @@ cst_wr_deinit(void) } static void -cst_route_hdr(const route_head *rte) +cst_route_hdr(const route_head* rte) { } static void -cst_route_tlr(const route_head *rte) +cst_route_tlr(const route_head* rte) { } static void -cst_write_wpt(const waypoint *wpt) +cst_write_wpt(const waypoint* wpt) { } diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 4b758434e..e70649c17 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -137,8 +137,8 @@ typedef enum { } xcsv_token; // Static definition of in_word_set to meet C99 rules as used by Clang. -static struct xt_mapping * -in_word_set(register const char *str, register unsigned int len); +static struct xt_mapping* +in_word_set(register const char* str, register unsigned int len); #include "xcsv_tokens.gperf" @@ -147,8 +147,8 @@ in_word_set(register const char *str, register unsigned int len); /****************************************************************************/ xcsv_file_t xcsv_file; -extern char *xcsv_urlbase; -extern char *prefer_shortnames; +extern char* xcsv_urlbase; +extern char* prefer_shortnames; #if CSVFMTS_ENABLED static double pathdist = 0; @@ -156,7 +156,7 @@ static double oldlon = 999; static double oldlat = 999; static int waypt_out_count; -static route_head *csv_track, *csv_route; +static route_head* csv_track, *csv_route; static double utm_northing, utm_easting, utm_zone = 0; static char utm_zonec; #endif // CSVFMTS_ENABLED @@ -168,17 +168,17 @@ static char utm_zonec; /* usage: p = csv_stringclean(stringtoclean, "&,\"") */ /* (strip out ampersands, commas, and quotes. */ /*********************************************************************/ -char * +char* #ifdef DEBUG_MEM -CSV_STRINGCLEAN(const char *string, const char *chararray, DEBUG_PARAMS) +CSV_STRINGCLEAN(const char* string, const char* chararray, DEBUG_PARAMS) #else -csv_stringclean(const char *string, const char *chararray) +csv_stringclean(const char* string, const char* chararray) #endif { - char * p1; - char * p2; - const char * cp; - char * tmp = xxstrdup(string,file,line); + char* p1; + char* p2; + const char* cp; + char* tmp = xxstrdup(string,file,line); if ((! string) || (! chararray)) { return (tmp); @@ -211,16 +211,16 @@ csv_stringclean(const char *string, const char *chararray) /* returns a copy of the modified string */ /* usage: p = csv_stringtrim(string, "\"", 0) */ /***********************************************************************************/ -char * +char* #ifdef DEBUG_MEM -CSV_STRINGTRIM(const char *string, const char *enclosure, int strip_max, DEBUG_PARAMS) +CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DEBUG_PARAMS) #else -csv_stringtrim(const char *string, const char *enclosure, int strip_max) +csv_stringtrim(const char* string, const char* enclosure, int strip_max) #endif { - static const char *p1 = NULL; - char *p2 = NULL; - char * tmp = xxstrdup(string,file,line); + static const char* p1 = NULL; + char* p2 = NULL; + char* tmp = xxstrdup(string,file,line); size_t elen; int stripped = 0; @@ -279,13 +279,13 @@ csv_stringtrim(const char *string, const char *enclosure, int strip_max) /* usage: p = csv_lineparse(string, ",", "\"", line) [initial call] */ /* p = csv_lineparse(NULL, ",", "\"", line) [subsequent calls] */ /*****************************************************************************/ -char * -csv_lineparse(const char *stringstart, const char *delimited_by, - const char *enclosed_in, const int line_no) +char* +csv_lineparse(const char* stringstart, const char* delimited_by, + const char* enclosed_in, const int line_no) { - const char *sp; - static const char *p = NULL; - static char *tmp = NULL; + const char* sp; + static const char* p = NULL; + static char* tmp = NULL; size_t dlen = 0, elen = 0, efound = 0; int enclosedepth = 0; short int dfound; @@ -362,13 +362,13 @@ csv_lineparse(const char *stringstart, const char *delimited_by, } /* allocate enough space for this data field */ - tmp = (char *) xcalloc((p - sp) + 1, sizeof(char)); + tmp = (char*) xcalloc((p - sp) + 1, sizeof(char)); strncpy(tmp, sp, (p - sp)); tmp[p - sp] = '\0'; if (elen && efound) { - char *c = csv_stringtrim(tmp, enclosed_in, 0); + char* c = csv_stringtrim(tmp, enclosed_in, 0); xfree(tmp); tmp = c; } @@ -432,10 +432,10 @@ intdeg_to_dec(const int ideg) /* lat = decdir_to_dec("30.1234N"); */ /*****************************************************************************/ static double -decdir_to_dec(const char * decdir) +decdir_to_dec(const char* decdir) { - char *p; - const char *cp; + char* p; + const char* cp; double rval; int sign = 0; @@ -466,7 +466,7 @@ decdir_to_dec(const char * decdir) /* lat = ddmmdir_to_degrees("30.1234N"); */ /*****************************************************************************/ static double -ddmmdir_to_degrees(const char * ddmmdir) +ddmmdir_to_degrees(const char* ddmmdir) { // if not N or E, prepend a '-' to ddmm2degrees input // see XT_LAT_NMEA which handles ddmm directly @@ -487,7 +487,7 @@ ddmmdir_to_degrees(const char * ddmmdir) *****************************************************************************/ void -human_to_dec(const char *instr, double *outlat, double *outlon, int which) +human_to_dec(const char* instr, double* outlat, double* outlon, int which) { double unk[3] = {999,999,999}; double lat[3] = {999,999,999}; @@ -496,19 +496,19 @@ human_to_dec(const char *instr, double *outlat, double *outlon, int which) int lonsign = 0; int unksign = 1; - const char *cur; - double *numres = unk; + const char* cur; + double* numres = unk; int numind = 0; - char *buff; + char* buff; if (strchr(instr, ',') != NULL) { - char *c; + char* c; buff = xstrdup(instr); while ((c = strchr(buff, ','))) { *c = '.'; } } else { - buff = (char *)instr; + buff = (char*)instr; } cur = buff; @@ -656,12 +656,12 @@ human_to_dec(const char *instr, double *outlat, double *outlon, int which) */ void -dec_to_human(char *buff, const char *format, const char *dirs, double val) +dec_to_human(char* buff, const char* format, const char* dirs, double val) { - char *subformat = NULL; - const char *formatptr = NULL; - char *percent = NULL; - char *type = NULL; + char* subformat = NULL; + const char* formatptr = NULL; + char* percent = NULL; + char* type = NULL; int index = 0; int intvals[3] = {0,0,0}; @@ -763,10 +763,10 @@ xcsv_file_init(void) /* usage: xcsv_ifield_add("DESCRIPTION", "", "%s") */ /*****************************************************************************/ void -xcsv_ifield_add(char *key, char *val, char *pfc) +xcsv_ifield_add(char* key, char* val, char* pfc) { - field_map_t *fmp = (field_map_t *) xcalloc(sizeof(*fmp), 1); - struct xt_mapping *xm = in_word_set(key, strlen(key)); + field_map_t* fmp = (field_map_t*) xcalloc(sizeof(*fmp), 1); + struct xt_mapping* xm = in_word_set(key, strlen(key)); fmp->key = key; fmp->hashed_key = xm ? xm->xt_token : -1; @@ -782,10 +782,10 @@ xcsv_ifield_add(char *key, char *val, char *pfc) /* usage: xcsv_ofield_add("LAT_DECIMAL", "", "%08.5lf") */ /*****************************************************************************/ void -xcsv_ofield_add(char *key, char *val, char *pfc, int options) +xcsv_ofield_add(char* key, char* val, char* pfc, int options) { - field_map_t *fmp = (field_map_t *) xcalloc(sizeof(*fmp), 1); - struct xt_mapping *xm = in_word_set(key, strlen(key)); + field_map_t* fmp = (field_map_t*) xcalloc(sizeof(*fmp), 1); + struct xt_mapping* xm = in_word_set(key, strlen(key)); fmp->key = key; fmp->hashed_key = xm ? xm->xt_token : -1; @@ -802,7 +802,7 @@ xcsv_ofield_add(char *key, char *val, char *pfc, int options) /* usage: xcsv_prologue_add("Four score and seven years ago today,") */ /*****************************************************************************/ void -xcsv_prologue_add(char *prologue) +xcsv_prologue_add(char* prologue) { ogue_t* ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1); @@ -816,9 +816,9 @@ xcsv_prologue_add(char *prologue) /* usage: xcsv_epilogue_add("shall not perish from the earth.") */ /*****************************************************************************/ void -xcsv_epilogue_add(char *epilogue) +xcsv_epilogue_add(char* epilogue) { - ogue_t * ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1); + ogue_t* ogp = (ogue_t*) xcalloc(sizeof(*ogp), 1); ogp->val = epilogue; ENQUEUE_TAIL(&xcsv_file.epilogue, &ogp->Q); @@ -827,7 +827,7 @@ xcsv_epilogue_add(char *epilogue) static time_t -yyyymmdd_to_time(const char *s) +yyyymmdd_to_time(const char* s) { int t = atol(s); struct tm tm; @@ -854,7 +854,7 @@ yyyymmdd_to_time(const char *s) */ static time_t -sscanftime(const char *s, const char *format, const int gmt) +sscanftime(const char* s, const char* format, const int gmt) { struct tm stm; memset(&stm, 0, sizeof(stm)); @@ -882,13 +882,13 @@ sscanftime(const char *s, const char *format, const int gmt) static time_t -addhms(const char *s, const char *format) +addhms(const char* s, const char* format) { time_t tt =0; int hour =0; int min =0; int sec =0; - char * ampm = NULL; + char* ampm = NULL; int ac; ampm = (char*) xmalloc(strlen(s)); @@ -907,9 +907,9 @@ addhms(const char *s, const char *format) static int -writetime(char * buff, size_t bufsize, const char * format, time_t t, int gmt) +writetime(char* buff, size_t bufsize, const char* format, time_t t, int gmt) { - static struct tm * stmp; + static struct tm* stmp; if (gmt) { stmp = gmtime(&t); @@ -924,10 +924,10 @@ writetime(char * buff, size_t bufsize, const char * format, time_t t, int gmt) /* not used */ static int -writeisotime(char * buff, size_t bufsize, const char * format, time_t t) +writeisotime(char* buff, size_t bufsize, const char* format, time_t t) { - static struct tm * stmp; - char * ibuff = NULL; + static struct tm* stmp; + char* ibuff = NULL; int i; ibuff = xmalloc(bufsize); @@ -942,10 +942,10 @@ writeisotime(char * buff, size_t bufsize, const char * format, time_t t) static int -writehms(char * buff, size_t bufsize, const char * format, time_t t, int gmt) +writehms(char* buff, size_t bufsize, const char* format, time_t t, int gmt) { static struct tm no_time = {0}; - static struct tm * stmp = &no_time; + static struct tm* stmp = &no_time; if (gmt) { stmp = gmtime(&t); @@ -967,7 +967,7 @@ long time_to_yyyymmdd(time_t t) { long b; - struct tm *tm = gmtime(&t); + struct tm* tm = gmtime(&t); b = (1900 + tm->tm_year) * 10000 + (1 + tm->tm_mon) * 100 + @@ -976,13 +976,13 @@ time_to_yyyymmdd(time_t t) return b; } -static garmin_fs_t * -gmsd_init(waypoint *wpt) +static garmin_fs_t* +gmsd_init(waypoint* wpt) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } return gmsd; } @@ -992,11 +992,11 @@ gmsd_init(waypoint *wpt) /* usage: xcsv_parse_val("-123.34", *waypt, *field_map) */ /*****************************************************************************/ static void -xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp, - route_head **trk) +xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp, + route_head** trk) { - char *enclosure = ""; - geocache_data *gc_data = NULL; + char* enclosure = ""; + geocache_data* gc_data = NULL; if (!fmp->printfc) { fatal(MYNAME ": xcsv style '%s' is missing format specifier", fmp->key); @@ -1119,7 +1119,7 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp, utm_northing = atof(s); break; case XT_UTM: { - char *ss; + char* ss; int i = 0;; utm_zone = strtod(s, &ss); @@ -1306,37 +1306,37 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp, break; /* GMSD ****************************************************************/ case XT_COUNTRY: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(country, csv_stringtrim(s, enclosure, 0)); } break; case XT_STATE: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(state, csv_stringtrim(s, enclosure, 0)); } break; case XT_CITY: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(city, csv_stringtrim(s, enclosure, 0)); } break; case XT_STREET_ADDR: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(addr, csv_stringtrim(s, enclosure, 0)); } break; case XT_POSTAL_CODE: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(postal_code, csv_stringtrim(s, enclosure, 0)); } break; case XT_PHONE_NR: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(phone_nr, csv_stringtrim(s, enclosure, 0)); } break; case XT_FACILITY: { - garmin_fs_t *gmsd = gmsd_init(wpt); + garmin_fs_t* gmsd = gmsd_init(wpt); GMSD_SET(facility, csv_stringtrim(s, enclosure, 0)); } break; @@ -1363,15 +1363,15 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp, void xcsv_data_read(void) { - char *buff; - char *s; - waypoint *wpt_tmp; + char* buff; + char* s; + waypoint* wpt_tmp; int linecount = 0; - queue *elem, *tmp; - field_map_t *fmp; - ogue_t *ogp; - route_head *rte = NULL; - route_head *trk = NULL; + queue* elem, *tmp; + field_map_t* fmp; + ogue_t* ogp; + route_head* rte = NULL; + route_head* trk = NULL; utm_northing = 0; utm_easting = 0; utm_zone = 0; @@ -1407,7 +1407,7 @@ xcsv_data_read(void) */ QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) { - ogp = (ogue_t *) elem; + ogp = (ogue_t*) elem; if (strncmp(buff, ogp->val, strlen(ogp->val)) == 0) { buff[0] = '\0'; break; @@ -1431,7 +1431,7 @@ xcsv_data_read(void) * off the beginning of buff since there's no index into queue. */ while (s) { - fmp = (field_map_t *) elem; + fmp = (field_map_t*) elem; xcsv_parse_val(s, wpt_tmp, fmp, &trk); elem = QUEUE_NEXT(elem); @@ -1492,7 +1492,7 @@ xcsv_data_read(void) } static void -xcsv_resetpathlen(const route_head *head) +xcsv_resetpathlen(const route_head* head) { pathdist = 0; oldlat = 999; @@ -1500,10 +1500,10 @@ xcsv_resetpathlen(const route_head *head) csv_route = csv_track = NULL; switch (xcsv_file.datatype) { case trkdata: - csv_track = (route_head *) head; + csv_track = (route_head*) head; break; case rtedata: - csv_route = (route_head *) head; + csv_route = (route_head*) head; break; default: break; @@ -1515,16 +1515,16 @@ xcsv_resetpathlen(const route_head *head) /* (the output meat) */ /*****************************************************************************/ static void -xcsv_waypt_pr(const waypoint *wpt) +xcsv_waypt_pr(const waypoint* wpt) { char buff[1024]; - char *shortname = NULL; - char *description = NULL; - char * anyname = NULL; - char * write_delimiter; + char* shortname = NULL; + char* description = NULL; + char* anyname = NULL; + char* write_delimiter; int i; - field_map_t *fmp; - queue *elem, *tmp; + field_map_t* fmp; + queue* elem, *tmp; double latitude, longitude; int32 utmz; double utme, utmn; @@ -1575,7 +1575,7 @@ xcsv_waypt_pr(const waypoint *wpt) } description = shortname; } else if (description) { - char *odesc = description; + char* odesc = description; description = xstrdup(odesc); xfree(odesc); } @@ -1587,7 +1587,7 @@ xcsv_waypt_pr(const waypoint *wpt) i = 0; QUEUE_FOR_EACH(xcsv_file.ofield, elem, tmp) { - char *obuff; + char* obuff; double lat = latitude; double lon = longitude; /* @@ -1598,7 +1598,7 @@ xcsv_waypt_pr(const waypoint *wpt) */ int field_is_unknown = 0; - fmp = (field_map_t *) elem; + fmp = (field_map_t*) elem; if ((i != 0) && !(fmp->options & OPTIONS_NODELIM)) { gbfprintf(xcsv_file.xcsvfp, write_delimiter); @@ -1620,7 +1620,7 @@ xcsv_waypt_pr(const waypoint *wpt) writebuff(buff, fmp->printfc, waypt_out_count + atoi(fmp->val)); break; case XT_CONSTANT: { - const char *cp = xcsv_get_char_from_constant_table(fmp->val); + const char* cp = xcsv_get_char_from_constant_table(fmp->val); if (cp) { writebuff(buff, fmp->printfc, cp); } else { @@ -1973,7 +1973,7 @@ xcsv_waypt_pr(const waypoint *wpt) field_is_unknown = !wpt->sat; break; case XT_GPS_FIX: { - char *fix = NULL; + char* fix = NULL; switch (wpt->fix) { case fix_unknown: field_is_unknown = 1; @@ -2000,37 +2000,37 @@ xcsv_waypt_pr(const waypoint *wpt) break; /* GMSD ************************************************************/ case XT_COUNTRY: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(country, "")); } break; case XT_STATE: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(state, "")); } break; case XT_CITY: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(city, "")); } break; case XT_POSTAL_CODE: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(postal_code, "")); } break; case XT_STREET_ADDR: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(addr, "")); } break; case XT_PHONE_NR: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(phone_nr, "")); } break; case XT_FACILITY: { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); writebuff(buff, fmp->printfc, GMSD_GET(facility, "")); } break; @@ -2087,7 +2087,7 @@ next: } static void -xcsv_noop(const route_head *wp) +xcsv_noop(const route_head* wp) { /* no-op */ } @@ -2099,8 +2099,8 @@ xcsv_noop(const route_head *wp) void xcsv_data_write(void) { - queue *elem, *tmp; - ogue_t *ogp; + queue* elem, *tmp; + ogue_t* ogp; time_t time; struct tm tm; char tbuf[32]; @@ -2117,8 +2117,8 @@ xcsv_data_write(void) /* output prologue lines, if any. */ QUEUE_FOR_EACH(&xcsv_file.prologue, elem, tmp) { - char *cout, *ctmp; - ogp = (ogue_t *) elem; + char* cout, *ctmp; + ogp = (ogue_t*) elem; cout = xstrdup((ogp->val) ? ogp->val : ""); @@ -2170,7 +2170,7 @@ xcsv_data_write(void) /* output epilogue lines, if any. */ QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) { - ogp = (ogue_t *) elem; + ogp = (ogue_t*) elem; gbfprintf(xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter); } } diff --git a/gpsbabel/csv_util.h b/gpsbabel/csv_util.h index 1d7c06386..18a8c62f2 100644 --- a/gpsbabel/csv_util.h +++ b/gpsbabel/csv_util.h @@ -19,25 +19,25 @@ /* function prototypes */ -char * +char* #ifndef DEBUG_MEM -csv_stringtrim(const char *string, const char *enclosure, int strip_max); +csv_stringtrim(const char* string, const char* enclosure, int strip_max); #else -CSV_STRINGTRIM(const char *string, const char *enclosure, int strip_max, DEBUG_PARAMS); +CSV_STRINGTRIM(const char* string, const char* enclosure, int strip_max, DEBUG_PARAMS); #define csv_stringtrim( s, e,m ) CSV_STRINGTRIM( s, e, m, __FILE__, __LINE__) #endif -char * -csv_lineparse(const char *stringstart, const char *delimited_by, const char *enclosed_in, const int line_no); +char* +csv_lineparse(const char* stringstart, const char* delimited_by, const char* enclosed_in, const int line_no); void -human_to_dec(const char *instr, double *outlat, double *outlon, int which); +human_to_dec(const char* instr, double* outlat, double* outlon, int which); -char * +char* #ifndef DEBUG_MEM -csv_stringclean(const char *string, const char *chararray); +csv_stringclean(const char* string, const char* chararray); #else -CSV_STRINGCLEAN(const char *string, const char *chararray,DEBUG_PARAMS); +CSV_STRINGCLEAN(const char* string, const char* chararray,DEBUG_PARAMS); #define csv_stringclean(s,c) CSV_STRINGCLEAN(s,c,__FILE__,__LINE__) #endif @@ -51,22 +51,22 @@ void xcsv_file_init(void); void -xcsv_prologue_add(char *); +xcsv_prologue_add(char*); void -xcsv_epilogue_add(char *); +xcsv_epilogue_add(char*); void -xcsv_ifield_add(char *, char *, char *); +xcsv_ifield_add(char*, char*, char*); void -xcsv_ofield_add(char *, char *, char *, int options); +xcsv_ofield_add(char*, char*, char*, int options); void xcsv_destroy_style(void); -const char * -xcsv_get_char_from_constant_table(char *key); +const char* +xcsv_get_char_from_constant_table(char* key); /****************************************************************************/ /* types required for various xcsv functions */ @@ -78,9 +78,9 @@ xcsv_get_char_from_constant_table(char *key); #define OPTIONS_OPTIONAL 3 typedef struct field_map { queue Q; - char * key; - char * val; - char * printfc; + char* key; + char* val; + char* printfc; int hashed_key; int options; } field_map_t; @@ -88,13 +88,13 @@ typedef struct field_map { /* a queuing struct for prologues / epilogues */ typedef struct ogue { queue Q; - char * val; + char* val; } ogue_t; /* something to map config file constants to chars */ typedef struct char_map { - const char * key; - const char * chars; + const char* key; + const char* chars; } char_map_t; /* @@ -113,22 +113,22 @@ typedef struct { /* footer lines for writing at the bottom of the file. */ queue epilogue; - char * field_delimiter; /* comma, quote, etc... */ - char * record_delimiter; /* newline, c/r, etc... */ + char* field_delimiter; /* comma, quote, etc... */ + char* record_delimiter; /* newline, c/r, etc... */ - char * badchars; /* characters we never write to output */ + char* badchars; /* characters we never write to output */ queue ifield; /* input field mapping */ - queue * ofield; /* output field mapping */ + queue* ofield; /* output field mapping */ int ifield_ct; /* actual # of ifields */ int ofield_ct; /* actual # of ofields */ - gbfile * xcsvfp; /* ptr to current *open* data file */ - char * fname; /* ptr to filename of above. */ + gbfile* xcsvfp; /* ptr to current *open* data file */ + char* fname; /* ptr to filename of above. */ - char * description; /* Description for help text */ - char * extension; /* preferred filename extension (for wrappers)*/ + char* description; /* Description for help text */ + char* extension; /* preferred filename extension (for wrappers)*/ short_handle mkshort_handle;/* handle for mkshort() */ ff_type type; /* format type for GUI wrappers. */ diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index 466ec7150..21fb3edc9 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -204,9 +204,9 @@ typedef struct { int verbose_status; /* set by GUI wrappers for status */ int smart_icons; int smart_names; - cet_cs_vec_t *charset; - char *charset_name; - inifile_t *inifile; + cet_cs_vec_t* charset; + char* charset_name; + inifile_t* inifile; } global_options; extern global_options global_opts; @@ -259,7 +259,7 @@ typedef enum { typedef struct { int is_html; - char *utfstring; + char* utfstring; } utf_string; typedef struct { @@ -272,32 +272,32 @@ typedef struct { status_type is_available:2; time_t exported; time_t last_found; - char *placer; /* Placer name */ + char* placer; /* Placer name */ int placer_id; /* Placer id */ - char *hint; /* all these UTF8, XML entities removed, May be not HTML. */ + char* hint; /* all these UTF8, XML entities removed, May be not HTML. */ utf_string desc_short; utf_string desc_long; } geocache_data ; typedef struct xml_tag { - char *tagname; - char *cdata; + char* tagname; + char* cdata; int cdatalen; - char *parentcdata; + char* parentcdata; int parentcdatalen; - char **attributes; - struct xml_tag *parent; - struct xml_tag *sibling; - struct xml_tag *child; + char** attributes; + struct xml_tag* parent; + struct xml_tag* sibling; + struct xml_tag* child; } xml_tag ; -typedef void (*fs_destroy)(void *); -typedef void (*fs_copy)(void **, void *); -typedef void (*fs_convert)(void *); +typedef void (*fs_destroy)(void*); +typedef void (*fs_copy)(void**, void*); +typedef void (*fs_convert)(void*); typedef struct format_specific_data { long type; - struct format_specific_data *next; + struct format_specific_data* next; fs_destroy destroy; fs_copy copy; @@ -310,17 +310,17 @@ typedef struct { } gb_color; -format_specific_data *fs_chain_copy(format_specific_data *source); -void fs_chain_destroy(format_specific_data *chain); -format_specific_data *fs_chain_find(format_specific_data *chain, long type); -void fs_chain_add(format_specific_data **chain, format_specific_data *data); +format_specific_data* fs_chain_copy(format_specific_data* source); +void fs_chain_destroy(format_specific_data* chain); +format_specific_data* fs_chain_find(format_specific_data* chain, long type); +void fs_chain_add(format_specific_data** chain, format_specific_data* data); typedef struct fs_xml { format_specific_data fs; - xml_tag *tag; + xml_tag* tag; } fs_xml; -fs_xml *fs_xml_alloc(long type); +fs_xml* fs_xml_alloc(long type); #define FS_GPX 0x67707800L #define FS_AN1W 0x616e3177L @@ -333,9 +333,9 @@ fs_xml *fs_xml_alloc(long type); * Structures and functions for multiple URLs per waypoint. */ typedef struct url_link { - struct url_link *url_next; - char *url; - char *url_link_text; + struct url_link* url_next; + char* url; + char* url_link_text; } url_link; /* @@ -414,20 +414,20 @@ typedef struct { * minimum length for shortname is 6 characters for NMEA units, * 8 for Magellan and 10 for Vista. These are only guidelines. */ - char *shortname; + char* shortname; /* * description is typically a human readable description of the * waypoint. It may be used as a comment field in some receivers. * These are probably under 40 bytes, but that's only a guideline. */ - char *description; + char* description; /* * notes are relatively long - over 100 characters - prose associated * with the above. Unlike shortname and description, these are never * used to compute anything else and are strictly "passed through". * Few formats support this. */ - char *notes; + char* notes; /* This is a bit icky. Multiple waypoint support is an * afterthought and I don't want to change our data structures. @@ -436,12 +436,12 @@ typedef struct { * We also use an implicit anonymous union here, so these three * members must match struct url_link... */ - struct url_link *url_next; - char *url; - char *url_link_text; + struct url_link* url_next; + char* url; + char* url_link_text; wp_flags wpt_flags; - const char *icon_descr; + const char* icon_descr; time_t creation_time; /* standardized in UTC/GMT */ int microseconds; /* Optional millionths of a second. */ @@ -472,25 +472,25 @@ typedef struct { unsigned char cadence; /* revolutions per minute */ float power; /* watts, as measured by cyclists */ float temperature; /* Degrees celsius */ - const geocache_data *gc_data; - format_specific_data *fs; - session_t *session; /* pointer to a session struct */ - void *extra_data; /* Extra data added by, say, a filter. */ + const geocache_data* gc_data; + format_specific_data* fs; + session_t* session; /* pointer to a session struct */ + void* extra_data; /* Extra data added by, say, a filter. */ } waypoint; typedef struct { queue Q; /* Link onto parent list. */ queue waypoint_list; /* List of child waypoints */ - char *rte_name; - char *rte_desc; - char *rte_url; + char* rte_name; + char* rte_desc; + char* rte_url; int rte_num; int rte_waypt_ct; /* # waypoints in waypoint list */ - format_specific_data *fs; + format_specific_data* fs; unsigned short cet_converted; /* strings are converted to UTF8; interesting only for input */ gb_color line_color; /* Optional line color for rendering */ int line_width; /* in pixels (sigh). < 0 is unknown. */ - session_t *session; /* pointer to a session struct */ + session_t* session; /* pointer to a session struct */ } route_head; /* @@ -529,97 +529,97 @@ typedef struct { extern posn_status tracking_status; -typedef void (*ff_init)(char const *); +typedef void (*ff_init)(char const*); typedef void (*ff_deinit)(void); typedef void (*ff_read)(void); typedef void (*ff_write)(void); typedef void (*ff_exit)(void); -typedef void (*ff_writeposn)(waypoint *); -typedef waypoint * (*ff_readposn)(posn_status *); +typedef void (*ff_writeposn)(waypoint*); +typedef waypoint* (*ff_readposn)(posn_status*); #ifndef DEBUG_MEM -char * get_option(const char *iarglist, const char *argname); +char* get_option(const char* iarglist, const char* argname); #else #define DEBUG_PARAMS const char *file, const int line -char *GET_OPTION(const char *iarglist, const char *argname, DEBUG_PARAMS); +char* GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS); #define get_option(iarglist, argname) GET_OPTION(iarglist, argname, __FILE__, __LINE__) #endif -typedef void (*filter_init)(char const *); +typedef void (*filter_init)(char const*); typedef void (*filter_process)(void); typedef void (*filter_deinit)(void); typedef void (*filter_exit)(void); -typedef void (*waypt_cb)(const waypoint *); -typedef void (*route_hdr)(const route_head *); -typedef void (*route_trl)(const route_head *); -void waypt_add(waypoint *); -waypoint * waypt_dupe(const waypoint *); -waypoint * waypt_new(void); -void waypt_del(waypoint *); -void waypt_free(waypoint *); +typedef void (*waypt_cb)(const waypoint*); +typedef void (*route_hdr)(const route_head*); +typedef void (*route_trl)(const route_head*); +void waypt_add(waypoint*); +waypoint* waypt_dupe(const waypoint*); +waypoint* waypt_new(void); +void waypt_del(waypoint*); +void waypt_free(waypoint*); void waypt_disp_all(waypt_cb); -void waypt_disp_session(const session_t *se, waypt_cb cb); -void waypt_init_bounds(bounds *bounds); -int waypt_bounds_valid(bounds *bounds); -void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp); -void waypt_compute_bounds(bounds *); +void waypt_disp_session(const session_t* se, waypt_cb cb); +void waypt_init_bounds(bounds* bounds); +int waypt_bounds_valid(bounds* bounds); +void waypt_add_to_bounds(bounds* bounds, const waypoint* waypointp); +void waypt_compute_bounds(bounds*); double gcgeodist(const double lat1, const double lon1, const double lat2, const double lon2); -void waypt_flush(queue *); +void waypt_flush(queue*); void waypt_flush_all(void); unsigned int waypt_count(void); void set_waypt_count(unsigned int nc); -void waypt_add_url(waypoint *wpt, char *link, char *url_link_text); -void free_gpx_extras(xml_tag * tag); -void xcsv_setup_internal_style(const char *style_buf); -void xcsv_read_internal_style(const char *style_buf); -waypoint * find_waypt_by_name(const char *name); -void waypt_backup(signed int *count, queue **head_bak); -void waypt_restore(signed int count, queue *head_bak); - -geocache_data *waypt_alloc_gc_data(waypoint *wpt); -int waypt_empty_gc_data(const waypoint *wpt); -geocache_type gs_mktype(const char *t); -geocache_container gs_mkcont(const char *t); - -route_head *route_head_alloc(void); -void route_add(waypoint *); -void route_add_wpt(route_head *rte, waypoint *wpt); -void route_del_wpt(route_head *rte, waypoint *wpt); -void track_add_wpt(route_head *rte, waypoint *wpt); -void track_del_wpt(route_head *rte, waypoint *wpt); -void route_add_head(route_head *rte); -void route_del_head(route_head *rte); -void route_reverse(const route_head *rte_hd); -waypoint * route_find_waypt_by_name(route_head *rh, const char *name); -void track_add_head(route_head *rte); -void track_del_head(route_head *rte); -void track_insert_head(route_head *rte, route_head *predecessor); -void route_disp(const route_head *rte, waypt_cb); +void waypt_add_url(waypoint* wpt, char* link, char* url_link_text); +void free_gpx_extras(xml_tag* tag); +void xcsv_setup_internal_style(const char* style_buf); +void xcsv_read_internal_style(const char* style_buf); +waypoint* find_waypt_by_name(const char* name); +void waypt_backup(signed int* count, queue** head_bak); +void waypt_restore(signed int count, queue* head_bak); + +geocache_data* waypt_alloc_gc_data(waypoint* wpt); +int waypt_empty_gc_data(const waypoint* wpt); +geocache_type gs_mktype(const char* t); +geocache_container gs_mkcont(const char* t); + +route_head* route_head_alloc(void); +void route_add(waypoint*); +void route_add_wpt(route_head* rte, waypoint* wpt); +void route_del_wpt(route_head* rte, waypoint* wpt); +void track_add_wpt(route_head* rte, waypoint* wpt); +void track_del_wpt(route_head* rte, waypoint* wpt); +void route_add_head(route_head* rte); +void route_del_head(route_head* rte); +void route_reverse(const route_head* rte_hd); +waypoint* route_find_waypt_by_name(route_head* rh, const char* name); +void track_add_head(route_head* rte); +void track_del_head(route_head* rte); +void track_insert_head(route_head* rte, route_head* predecessor); +void route_disp(const route_head* rte, waypt_cb); void route_disp_all(route_hdr, route_trl, waypt_cb); void track_disp_all(route_hdr, route_trl, waypt_cb); -void route_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc); -void track_disp_session(const session_t *se, route_hdr rh, route_trl rt, waypt_cb wc); -void route_flush(queue *); +void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc); +void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc); +void route_flush(queue*); void route_flush_all(void); void route_flush_all_routes(void); void route_flush_all_tracks(void); -route_head * route_find_route_by_name(const char *name); -route_head * route_find_track_by_name(const char *name); +route_head* route_find_route_by_name(const char* name); +route_head* route_find_track_by_name(const char* name); unsigned int route_waypt_count(void); unsigned int route_count(void); unsigned int track_waypt_count(void); unsigned int track_count(void); -void route_copy(int *dst_count, int *dst_wpt_count, queue **dst, queue *src); -void route_backup(signed int *count, queue **head_bak); -void route_restore(queue *head_bak); -void route_append(queue *src); -void track_backup(signed int *count, queue **head_bak); -void track_restore(queue *head_bak); -void track_append(queue *src); -void route_flush(queue *head); -void track_recompute(const route_head *trk, computed_trkdata **); +void route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src); +void route_backup(signed int* count, queue** head_bak); +void route_restore(queue* head_bak); +void route_append(queue* src); +void track_backup(signed int* count, queue** head_bak); +void track_restore(queue* head_bak); +void track_append(queue* src); +void route_flush(queue* head); +void track_recompute(const route_head* trk, computed_trkdata**); /* * All shortname functions take a shortname handle as the first arg. @@ -629,9 +629,9 @@ void track_recompute(const route_head *trk, computed_trkdata **); #define PRIME 37 typedef struct { unsigned int target_len; - char *badchars; - char *goodchars; - char *defname; + char* badchars; + char* goodchars; + char* defname; queue namelist[PRIME]; /* Various internal flags at end to allow alignment flexibility. */ @@ -644,24 +644,24 @@ typedef struct { typedef mkshort_handle_imp* short_handle; #ifndef DEBUG_MEM -char *mkshort(short_handle, const char *); +char* mkshort(short_handle, const char*); short_handle mkshort_new_handle(void); #else -char *MKSHORT(short_handle, const char *, DEBUG_PARAMS); -void *MKSHORT_NEW_HANDLE(DEBUG_PARAMS); +char* MKSHORT(short_handle, const char*, DEBUG_PARAMS); +void* MKSHORT_NEW_HANDLE(DEBUG_PARAMS); #define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__) #define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__) #endif -char *mkshort_from_wpt(short_handle h, const waypoint *wpt); -void mkshort_del_handle(short_handle *h); +char* mkshort_from_wpt(short_handle h, const waypoint* wpt); +void mkshort_del_handle(short_handle* h); void setshort_length(short_handle, int n); -void setshort_badchars(short_handle, const char *); -void setshort_goodchars(short_handle, const char *); +void setshort_badchars(short_handle, const char*); +void setshort_goodchars(short_handle, const char*); void setshort_mustupper(short_handle, int n); void setshort_mustuniq(short_handle, int n); void setshort_whitespace_ok(short_handle, int n); void setshort_repeating_whitespace_ok(short_handle, int n); -void setshort_defname(short_handle, const char *s); +void setshort_defname(short_handle, const char* s); void setshort_is_utf8(short_handle h, const int is_utf8); /* @@ -669,7 +669,7 @@ void setshort_is_utf8(short_handle h, const int is_utf8); */ #define VMFL_NOZERO (1 << 0) typedef struct vmem { - char *mem; /* visible memory object */ + char* mem; /* visible memory object */ size_t size; /* allocated size of object */ } vmem_t; vmem_t vmem_alloc(size_t, int flags); @@ -715,14 +715,14 @@ void vmem_realloc(vmem_t*, size_t); #define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX} typedef struct arglist { - const char *argstring; - char **argval; - const char *helpstring; - const char *defaultvalue; + const char* argstring; + char** argval; + const char* helpstring; + const char* defaultvalue; const gbuint32 argtype; - const char *minvalue; /* minimum value for numeric options */ - const char *maxvalue; /* maximum value for numeric options */ - char *argvalptr; /* !!! internal helper. Not used in definitions !!! */ + const char* minvalue; /* minimum value for numeric options */ + const char* maxvalue; /* maximum value for numeric options */ + char* argvalptr; /* !!! internal helper. Not used in definitions !!! */ } arglist_t; typedef enum { @@ -775,54 +775,54 @@ typedef struct ff_vecs { ff_read read; ff_write write; ff_exit exit; - arglist_t *args; - const char *encode; + arglist_t* args; + const char* encode; int fixed_encode; position_ops_t position_ops; - const char *name; /* dyn. initialized by find_vec */ + const char* name; /* dyn. initialized by find_vec */ } ff_vecs_t; typedef struct style_vecs { - const char *name; - const char *style_buf; + const char* name; + const char* style_buf; } style_vecs_t; extern style_vecs_t style_list[]; void waypt_init(void); void route_init(void); -void waypt_disp(const waypoint *); +void waypt_disp(const waypoint*); void waypt_status_disp(int total_ct, int myct); -double waypt_time(const waypoint *wpt); -double waypt_speed(const waypoint *A, const waypoint *B); -double waypt_speed_ex(const waypoint *A, const waypoint *B); -double waypt_course(const waypoint *A, const waypoint *B); -double waypt_distance(const waypoint *A, const waypoint *B); -double waypt_distance_ex(const waypoint *A, const waypoint *B); - -NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2); -void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3); -void warning(const char *, ...) PRINTFLIKE(1, 2); - -ff_vecs_t *find_vec(char * const, char **); -void assign_option(const char *vecname, arglist_t *ap, const char *val); -void disp_vec_options(const char *vecname, arglist_t *ap); +double waypt_time(const waypoint* wpt); +double waypt_speed(const waypoint* A, const waypoint* B); +double waypt_speed_ex(const waypoint* A, const waypoint* B); +double waypt_course(const waypoint* A, const waypoint* B); +double waypt_distance(const waypoint* A, const waypoint* B); +double waypt_distance_ex(const waypoint* A, const waypoint* B); + +NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2); +void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3); +void warning(const char*, ...) PRINTFLIKE(1, 2); + +ff_vecs_t* find_vec(char* const, char**); +void assign_option(const char* vecname, arglist_t* ap, const char* val); +void disp_vec_options(const char* vecname, arglist_t* ap); void disp_vecs(void); -void disp_vec(const char *vecname); +void disp_vec(const char* vecname); void init_vecs(void); void exit_vecs(void); void disp_formats(int version); -const char * name_option(long type); +const char* name_option(long type); void printposn(const double c, int is_lat); #ifndef DEBUG_MEM -void *xcalloc(size_t nmemb, size_t size); -void *xmalloc(size_t size); -void *xrealloc(void *p, size_t s); -void xfree(void *mem); -char *xstrdup(const char *s); -char *xstrndup(const char *s, size_t n); -char *xstrndupt(const char *s, size_t n); -char *xstrappend(char *src, const char *addon); +void* xcalloc(size_t nmemb, size_t size); +void* xmalloc(size_t size); +void* xrealloc(void* p, size_t s); +void xfree(void* mem); +char* xstrdup(const char* s); +char* xstrndup(const char* s, size_t n); +char* xstrndupt(const char* s, size_t n); +char* xstrappend(char* src, const char* addon); #define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size) #define xxmalloc(size, file, line) xmalloc(size) #define xxrealloc(p, s, file, line) xrealloc(p,s) @@ -830,16 +830,16 @@ char *xstrappend(char *src, const char *addon); #define xxstrdup(s, file, line) xstrdup(s) #define xxstrappend(src, addon, file, line) xstrappend(src, addon) #else /* DEBUG_MEM */ -void *XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS); -void *XMALLOC(size_t size, DEBUG_PARAMS); -void *XREALLOC(void *p, size_t s, DEBUG_PARAMS); -void XFREE(void *mem, DEBUG_PARAMS); -char *XSTRDUP(const char *s, DEBUG_PARAMS); -char *XSTRNDUP(const char *src, size_t size, DEBUG_PARAMS); -char *XSTRNDUPT(const char *src, size_t size, DEBUG_PARAMS); -char *XSTRAPPEND(char *src, const char *addon, DEBUG_PARAMS); +void* XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS); +void* XMALLOC(size_t size, DEBUG_PARAMS); +void* XREALLOC(void* p, size_t s, DEBUG_PARAMS); +void XFREE(void* mem, DEBUG_PARAMS); +char* XSTRDUP(const char* s, DEBUG_PARAMS); +char* XSTRNDUP(const char* src, size_t size, DEBUG_PARAMS); +char* XSTRNDUPT(const char* src, size_t size, DEBUG_PARAMS); +char* XSTRAPPEND(char* src, const char* addon, DEBUG_PARAMS); void debug_mem_open(); -void debug_mem_output(char *format, ...); +void debug_mem_output(char* format, ...); void debug_mem_close(); #define xcalloc(nmemb, size) XCALLOC(nmemb, size, __FILE__, __LINE__) #define xmalloc(size) XMALLOC(size, __FILE__, __LINE__) @@ -858,43 +858,43 @@ void debug_mem_close(); #define xxstrappend XSTRAPPEND #endif /* DEBUG_MEM */ -FILE *xfopen(const char *fname, const char *type, const char *errtxt); -void xfprintf(const char *errtxt, FILE *stream, const char *format, ...); -void xfputs(const char *errtxt, const char *s, FILE *stream); - -int case_ignore_strcmp(const char *s1, const char *s2); -int case_ignore_strncmp(const char *s1, const char *s2, int n); -int str_match(const char *str, const char *match); -int case_ignore_str_match(const char *str, const char *match); -char * strenquote(const char *str, const char quot_char); - -char *strsub(const char *s, const char *search, const char *replace); -char *gstrsub(const char *s, const char *search, const char *replace); -char *xstrrstr(const char *s1, const char *s2); -void rtrim(char *s); -char * lrtrim(char *s); -int xasprintf(char **strp, const char *fmt, ...); -int xvasprintf(char **strp, const char *fmt, va_list ap); -char *strupper(char *src); -char *strlower(char *src); +FILE* xfopen(const char* fname, const char* type, const char* errtxt); +void xfprintf(const char* errtxt, FILE* stream, const char* format, ...); +void xfputs(const char* errtxt, const char* s, FILE* stream); + +int case_ignore_strcmp(const char* s1, const char* s2); +int case_ignore_strncmp(const char* s1, const char* s2, int n); +int str_match(const char* str, const char* match); +int case_ignore_str_match(const char* str, const char* match); +char* strenquote(const char* str, const char quot_char); + +char* strsub(const char* s, const char* search, const char* replace); +char* gstrsub(const char* s, const char* search, const char* replace); +char* xstrrstr(const char* s1, const char* s2); +void rtrim(char* s); +char* lrtrim(char* s); +int xasprintf(char** strp, const char* fmt, ...); +int xvasprintf(char** strp, const char* fmt, va_list ap); +char* strupper(char* src); +char* strlower(char* src); signed int get_tz_offset(void); -time_t mklocaltime(struct tm *t); -time_t mkgmtime(struct tm *t); +time_t mklocaltime(struct tm* t); +time_t mkgmtime(struct tm* t); time_t current_time(void); -void dotnet_time_to_time_t(double dotnet, time_t *t, int *ms); -signed int month_lookup(const char *m); -const char *get_cache_icon(const waypoint *waypointp); -const char *gs_get_cachetype(geocache_type t); -const char *gs_get_container(geocache_container t); -char * xml_entitize(const char * str); -char * html_entitize(const char * str); -char * strip_html(const utf_string*); -char * strip_nastyhtml(const char * in); -char * convert_human_date_format(const char *human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */ -char * convert_human_time_format(const char *human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */ -char * pretty_deg_format(double lat, double lon, char fmt, const char *sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */ - -char * get_filename(const char *fname); /* extract the filename portion */ +void dotnet_time_to_time_t(double dotnet, time_t* t, int* ms); +signed int month_lookup(const char* m); +const char* get_cache_icon(const waypoint* waypointp); +const char* gs_get_cachetype(geocache_type t); +const char* gs_get_container(geocache_container t); +char* xml_entitize(const char* str); +char* html_entitize(const char* str); +char* strip_html(const utf_string*); +char* strip_nastyhtml(const char* in); +char* convert_human_date_format(const char* human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */ +char* convert_human_time_format(const char* human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */ +char* pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */ + +char* get_filename(const char* fname); /* extract the filename portion */ /* * Character encoding transformations. @@ -914,13 +914,13 @@ char * get_filename(const char *fname); /* extract the filename portion */ #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str)) /* this lives in gpx.c */ -time_t xml_parse_time(const char *cdatastr, int * microsecs); +time_t xml_parse_time(const char* cdatastr, int* microsecs); -xml_tag *xml_findfirst(xml_tag *root, const char *tagname); -xml_tag *xml_findnext(xml_tag *root, xml_tag *cur, const char *tagname); -char *xml_attribute(xml_tag *tag, const char *attrname); +xml_tag* xml_findfirst(xml_tag* root, const char* tagname); +xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname); +char* xml_attribute(xml_tag* tag, const char* attrname); -char * rot13(const char *str); +char* rot13(const char* str); /* * PalmOS records like fixed-point numbers, which should be rounded @@ -952,33 +952,33 @@ typedef struct { * Protypes for Endianness helpers. */ -signed int be_read16(const void *p); -unsigned int be_readu16(const void *p); -signed int be_read32(const void *p); -signed int le_read16(const void *p); -unsigned int le_readu16(const void *p); -signed int le_read32(const void *p); -unsigned int le_readu32(const void *p); -void le_read64(void *dest, const void *src); -void be_write16(void *pp, const unsigned i); -void be_write32(void *pp, const unsigned i); -void le_write16(void *pp, const unsigned i); -void le_write32(void *pp, const unsigned i); +signed int be_read16(const void* p); +unsigned int be_readu16(const void* p); +signed int be_read32(const void* p); +signed int le_read16(const void* p); +unsigned int le_readu16(const void* p); +signed int le_read32(const void* p); +unsigned int le_readu32(const void* p); +void le_read64(void* dest, const void* src); +void be_write16(void* pp, const unsigned i); +void be_write32(void* pp, const unsigned i); +void le_write16(void* pp, const unsigned i); +void le_write32(void* pp, const unsigned i); double endian_read_double(const void* ptr, int read_le); float endian_read_float(const void* ptr, int read_le); void endian_write_double(void* ptr, double d, int write_le); void endian_write_float(void* ptr, float f, int write_le); -float be_read_float(void *p); -double be_read_double(void *p); -void be_write_float(void *pp, float d); -void be_write_double(void *pp, double d); +float be_read_float(void* p); +double be_read_double(void* p); +void be_write_float(void* pp, float d); +void be_write_double(void* pp, double d); -float le_read_float(const void *p); -double le_read_double(const void *p); -void le_write_float(void *ptr, float f); -void le_write_double(void *p, double d); +float le_read_float(const void* p); +double le_read_double(const void* p); +void le_write_float(void* ptr, float f); +void le_write_double(void* p, double d); #define pdb_write_float be_write_float #define pdb_read_float be_read_float @@ -1010,26 +1010,26 @@ typedef enum { /* bit manipulation functions (util.c) */ -char gb_getbit(const void *buf, const gbuint32 nr); -void gb_setbit(void *buf, const gbuint32 nr); +char gb_getbit(const void* buf, const gbuint32 nr); +void gb_setbit(void* buf, const gbuint32 nr); -void *gb_int2ptr(const int i); -int gb_ptr2int(const void *p); +void* gb_int2ptr(const int i); +int gb_ptr2int(const void* p); /* * From parse.c */ -int parse_coordinates(const char *str, int datum, const grid_type grid, - double *latitude, double *longitude, const char *module); -int parse_distance(const char *str, double *val, double scale, const char *module); -int parse_speed(const char *str, double *val, const double scale, const char *module); -time_t parse_date(const char *str, const char *format, const char *module); +int parse_coordinates(const char* str, int datum, const grid_type grid, + double* latitude, double* longitude, const char* module); +int parse_distance(const char* str, double* val, double scale, const char* module); +int parse_speed(const char* str, double* val, const double scale, const char* module); +time_t parse_date(const char* str, const char* format, const char* module); /* * From util_crc.c */ -unsigned long get_crc32(const void * data, int datalen); -unsigned long get_crc32_s(const void * data); +unsigned long get_crc32(const void* data, int datalen); +unsigned long get_crc32_s(const void* data); /* * From units.c @@ -1043,9 +1043,9 @@ typedef enum { } fmt_units; int fmt_setunits(fmt_units); -double fmt_distance(const double, char **tag); -double fmt_altitude(const double, char **tag); -double fmt_speed(const double, char **tag); +double fmt_distance(const double, char** tag); +double fmt_altitude(const double, char** tag); +double fmt_speed(const double, char** tag); /* * From gbsleep.c @@ -1055,12 +1055,12 @@ void gb_sleep(unsigned long microseconds); /* * From nmea.c */ -int nmea_cksum(const char *const buf); +int nmea_cksum(const char* const buf); /* * Color helpers. */ -int color_to_bbggrr(const char *cname); +int color_to_bbggrr(const char* cname); /* * A constant for unknown altitude. It's tempting to just use zero diff --git a/gpsbabel/delbin.c b/gpsbabel/delbin.c index 7c958dae1..84c07e592 100644 --- a/gpsbabel/delbin.c +++ b/gpsbabel/delbin.c @@ -88,8 +88,8 @@ static unsigned delbin_os_packet_size; #define DELBIN_MAX_UNITS 32 static struct { unsigned int unit_number; - const char *unit_serial_number; - const char *unit_name; + const char* unit_serial_number; + const char* unit_name; } delbin_unit_info[DELBIN_MAX_UNITS]; static int n_delbin_units; @@ -97,15 +97,15 @@ static int n_delbin_units; #define sizeofarray(x) (sizeof(x) / sizeof(x[0])) -static char *opt_getposn = NULL; -static char *opt_logs = NULL; -static char *opt_long_notes = NULL; -static char *opt_nuke_wpt = NULL; -static char *opt_nuke_trk = NULL; -static char *opt_nuke_rte = NULL; +static char* opt_getposn = NULL; +static char* opt_logs = NULL; +static char* opt_long_notes = NULL; +static char* opt_nuke_wpt = NULL; +static char* opt_nuke_trk = NULL; +static char* opt_nuke_rte = NULL; /* If true, Order hint to match Cache Register and Topo 7 */ -static char *opt_hint_at_end = NULL; -static char *opt_gcsym = NULL; +static char* opt_hint_at_end = NULL; +static char* opt_gcsym = NULL; static arglist_t delbin_args[] = { @@ -511,7 +511,7 @@ packet_read(void* buf) } if (global_opts.debug_level >= DBGLVL_H) { unsigned j; - const gbuint8* p = buf; + const gbuint8* p = (const gbuint8*) buf; debug_out_time("pcktrd"); for (j = 0; j < n; j++) { @@ -535,7 +535,7 @@ packet_write(const void* buf, unsigned size) unsigned n; if (global_opts.debug_level >= DBGLVL_H) { unsigned j; - const gbuint8* p = buf; + const gbuint8* p = (const gbuint8*) buf; debug_out_time("pcktwr"); for (j = 0; j < size; j++) { @@ -573,7 +573,7 @@ static void message_init(message_t* m) { m->capacity = 100; - m->buf = xmalloc(m->capacity); + m->buf = (gbuint8*)xmalloc(m->capacity); m->data = m->buf + 2 + 8; } @@ -582,7 +582,7 @@ message_init_size(message_t* m, unsigned size) { m->size = size; m->capacity = 2 + 8 + size + 4; - m->buf = xmalloc(m->capacity); + m->buf = (gbuint8*)xmalloc(m->capacity); m->data = m->buf + 2 + 8; } @@ -601,7 +601,7 @@ message_ensure_size(message_t* m, unsigned size) if (m->capacity < 2 + 8 + size + 4) { m->capacity = 2 + 8 + size + 4; xfree(m->buf); - m->buf = xmalloc(m->capacity); + m->buf = (gbuint8*)xmalloc(m->capacity); m->data = m->buf + 2 + 8; } } @@ -753,7 +753,7 @@ message_ack(unsigned id, const message_t* m) { message_t ack; char* p1; - const char* p2 = m->data; + const char* p2 = (const char*) m->data; switch (id) { case MSG_ACK: case MSG_NACK: @@ -763,7 +763,7 @@ message_ack(unsigned id, const message_t* m) return; } message_init_size(&ack, 4); - p1 = ack.data; + p1 = (char*) ack.data; // ack payload is id and body checksum of acked message le_write16(p1, id); p1[2] = p2[m->size]; @@ -789,7 +789,7 @@ message_read(unsigned msg_id, message_t* m) break; } if (id == MSG_ERROR) { - const gbuint8* p = m->data; + const gbuint8* p = (const gbuint8*) m->data; fatal(MYNAME ": device error %u: \"%s\"\n", *p, p + 1); } message_ack(id, m); @@ -806,7 +806,7 @@ get_batch(message_t** array, unsigned* n) { int success = 1; unsigned array_max = 100; - message_t* a = xmalloc(array_max * sizeof(message_t)); + message_t* a = (message_t*) xmalloc(array_max * sizeof(message_t)); unsigned i = 0; unsigned id; if (global_opts.debug_level >= DBGLVL_M) { @@ -817,7 +817,7 @@ get_batch(message_t** array, unsigned* n) if (i == array_max) { message_t* old_a = a; array_max += array_max; - a = xmalloc(array_max * sizeof(message_t)); + a = (message_t*) xmalloc(array_max * sizeof(message_t)); memcpy(a, old_a, i * sizeof(message_t)); xfree(old_a); } @@ -865,7 +865,7 @@ get_batch(message_t** array, unsigned* n) static struct { unsigned msg_id; message_t msg; -} *batch_array; +}* batch_array; static unsigned batch_array_max; static unsigned batch_array_i; @@ -991,7 +991,7 @@ static waypoint* decode_waypoint(const void* data) { waypoint* wp = waypt_new(); - const msg_waypoint_t* p = data; + const msg_waypoint_t* p = (const msg_waypoint_t*)data; const char* s; float f; @@ -1085,7 +1085,7 @@ read_waypoints(void) warning(MYNAME ": read waypoint '%s'\n", wp->description); } } else if (wp && id == MSG_WAYPOINT_NOTE_OUT) { - const msg_waypoint_note_t* p = msg_array[i].data; + const msg_waypoint_note_t* p = (const msg_waypoint_note_t*) msg_array[i].data; const char* s = p->name + p->name_size; unsigned nn = le_readu16(s); if (notes_max < notes_i + nn) { @@ -1096,7 +1096,7 @@ read_waypoints(void) do { notes_max += notes_max; } while (notes_max < notes_i + nn); - wp->notes = xmalloc(notes_max); + wp->notes = (char*) xmalloc(notes_max); if (old) { memcpy(wp->notes, old, notes_i); xfree(old); @@ -1300,7 +1300,7 @@ get_gc_notes(const waypoint* wp, int* symbol, char** notes, unsigned* notes_size } gbfputc(0, fd); *notes_size = fd->memlen; - *notes = xmalloc(*notes_size); + *notes = (char*) xmalloc(*notes_size); memcpy(*notes, fd->handle.mem, *notes_size); gbfclose(fd); } @@ -1319,7 +1319,7 @@ write_waypoint_notes(const char* notes, unsigned size, const char* name) unsigned n = bytes_per_msg; msg_waypoint_note_t* p; message_init_size(&m, 2 + 2 + 1 + name_size + 2 + bytes_per_msg); - p = m.data; + p = (msg_waypoint_note_t*) m.data; le_write16(p->index, i++); le_write16(p->total, msg_count); p->name_size = name_size; @@ -1349,7 +1349,7 @@ add_nuke(nuke_type type) msg_delete_t* p; message_init_size(&m, MSG_DELETE_SIZE); - p = m.data; + p = (msg_delete_t*) m.data; p->type = type; p->mode = nuke_mode_all; p->location = nuke_dest_internal; @@ -1406,7 +1406,7 @@ write_waypoint(const waypoint* wp) name_size = 255; } message_init_size(&m, 31 + name_size + notes_size); - p = m.data; + p = (msg_waypoint_t*) m.data; waypoint_i++; le_write32(p->total, waypoint_n); @@ -1514,7 +1514,7 @@ decode_sat_fix(waypoint* wp, const gbuint8 status) static void decode_track_point(const void* data, unsigned* wp_array_i, unsigned max_point) { - const msg_track_point_t* p = data; + const msg_track_point_t* p = (const msg_track_point_t*) data; const unsigned n = p->number; unsigned i; unsigned j = *wp_array_i; @@ -1579,13 +1579,13 @@ read_track(route_head* track) fatal(MYNAME ": reading track '%s' failed (missing track header)\n", track->rte_name); } // process track messages - p = msg_array[0].data; + p = (const msg_track_header_t*) msg_array[0].data; if (le_readu16(p->comment_size)) { track->rte_desc = xstrdup(p->comment); } track->line_color.bbggrr = track_color(p->color[0]); n_point = le_readu32(p->total_points); - wp_array = xcalloc(n_point, sizeof(*wp_array)); + wp_array = (waypoint**) xcalloc(n_point, sizeof(*wp_array)); message_free(&msg_array[0]); for (i = 1; i < msg_array_n; i++) { unsigned id = message_get_id(&msg_array[i]); @@ -1663,11 +1663,11 @@ read_tracks(void) message_write(MSG_BREAK, &m); } message_free(&m); - track_array = xcalloc(total, sizeof(*track_array)); + track_array = (route_head**) xcalloc(total, sizeof(*track_array)); for (i = 0; i < msg_array_n; i++) { unsigned id = message_get_id(&msg_array[i]); if (id == MSG_TRACK_HEADER_OUT) { - const msg_track_header_t* p = msg_array[i].data; + const msg_track_header_t* p = (msg_track_header_t*) msg_array[i].data; if (le_readu32(p->total_points)) { track_array[i] = route_head_alloc(); track_array[i]->rte_name = xstrdup(p->name); @@ -1705,7 +1705,7 @@ write_track_points(void) if (j == 0) { message_init_size(&m, 9 + 23 * pt_per_msg); - p = m.data; + p =(msg_track_point_t*) m.data; le_write32(p->total, waypoint_n); le_write32(p->index, i + 1); } @@ -1761,7 +1761,7 @@ write_track_begin(const route_head* track) waypoint_i = 0; waypoint_n = track->rte_waypt_ct; if (waypoint_n) { - wp_array = xmalloc(waypoint_n * sizeof(*wp_array)); + wp_array = (waypoint**) xmalloc(waypoint_n * sizeof(*wp_array)); } } @@ -1785,7 +1785,7 @@ write_track_end(const route_head* track) comment_size = strlen(track->rte_desc) + 1; } message_init_size(&m, sizeof(msg_track_header_in_t) - 1 + comment_size); - p = m.data; + p = (msg_track_header_in_t*) m.data; memset(p->name, 0, sizeof(p->name)); if (track->rte_name) { strncpy(p->name, track->rte_name, sizeof(p->name) - 1); @@ -1817,7 +1817,7 @@ write_tracks(void) static void decode_route_shape(const void* data, unsigned* wp_array_i) { - const msg_route_shape_t* p = data; + const msg_route_shape_t* p = (msg_route_shape_t*) data; const unsigned n = p->number; unsigned i; unsigned j = *wp_array_i; @@ -1837,7 +1837,7 @@ decode_route_shape(const void* data, unsigned* wp_array_i) static waypoint* decode_route_point(const void* data) { - const msg_route_point_t* p = data; + const msg_route_point_t* p = (const msg_route_point_t*) data; const char* s = NULL; gbfile* fd = gbfopen(NULL, "w", MYNAME); waypoint* wp = waypt_new(); @@ -1908,7 +1908,7 @@ decode_route_point(const void* data) } if (fd->memlen) { gbfputc(0, fd); - wp->notes = xmalloc(fd->memlen); + wp->notes = (char*) xmalloc(fd->memlen); memcpy(wp->notes, fd->handle.mem, fd->memlen); } gbfclose(fd); @@ -1951,11 +1951,11 @@ read_route(route_head* route) if (msg_array_n == 0 || message_get_id(&msg_array[0]) != MSG_ROUTE_HEADER_OUT) { fatal(MYNAME ": missing route header\n"); } - p = msg_array[0].data; + p = (const msg_route_header_t*) msg_array[0].data; route_total = le_readu32(p->total_route_point); shape_total = le_readu32(p->total_shape_point); total = route_total + shape_total; - wp_array = xcalloc(total, sizeof(*wp_array)); + wp_array = (waypoint**) xcalloc(total, sizeof(*wp_array)); if (global_opts.debug_level >= DBGLVL_L) { warning(MYNAME ": route '%s' %u points, %u shape points\n", route->rte_name, route_total, shape_total); @@ -2040,7 +2040,7 @@ read_routes(void) message_write(MSG_BREAK, &m); } message_free(&m); - route_array = xcalloc(total, sizeof(*route_array)); + route_array = (route_head**) xcalloc(total, sizeof(*route_array)); for (i = 0; i < msg_array_n; i++) { unsigned id = message_get_id(&msg_array[i]); if (id == MSG_ROUTE_HEADER_OUT) { @@ -2078,7 +2078,7 @@ write_route_shape_points(waypoint** array, unsigned n) do { if (j == 0) { message_init_size(&m, 10 + 8 * pt_per_msg); - p = m.data; + p = (msg_route_shape_t*) m.data; le_write32(p->total, n); le_write32(p->index, i + 1); p->reserved = 0; @@ -2111,7 +2111,7 @@ write_route_points(void) char* s; message_init_size(&m, sizeof(msg_route_point_t) + 1 + 1 + 4); - p = m.data; + p = (msg_route_point_t*) m.data; memset(m.data, 0, m.size); route_point_i++; shape_n = shape_point_counts[route_point_i]; @@ -2150,8 +2150,8 @@ write_route_begin(const route_head* track) shape_point_n = 0; waypoint_n = track->rte_waypt_ct; if (waypoint_n) { - wp_array = xmalloc(waypoint_n * sizeof(*wp_array)); - shape_point_counts = xcalloc(waypoint_n, sizeof(*shape_point_counts)); + wp_array = (waypoint**) xmalloc(waypoint_n * sizeof(*wp_array)); + shape_point_counts = (unsigned int*) xcalloc(waypoint_n, sizeof(*shape_point_counts)); } } @@ -2178,7 +2178,7 @@ write_route_end(const route_head* route) return; } message_init_size(&m, sizeof(msg_route_header_in_t)); - p = m.data; + p = (msg_route_header_in_t*) m.data; memset(p->name, 0, sizeof(p->name)); if (route->rte_name) { strncpy(p->name, route->rte_name, sizeof(p->name) - 1); @@ -2210,7 +2210,7 @@ static waypoint* decode_navmsg(const void* data) { waypoint* wp = waypt_new(); - const msg_navigation_t* p = data; + const msg_navigation_t* p = (const msg_navigation_t*) data; struct tm t; t.tm_year = le_readu16(p->year) - 1900; @@ -2246,7 +2246,7 @@ read_position(void) wp = decode_navmsg(m.data); if (wp->fix > fix_none && message_read_1(MSG_SATELLITE_INFO, &m) == MSG_SATELLITE_INFO) { - const msg_satellite_t* p = m.data; + const msg_satellite_t* p = (const msg_satellite_t*) m.data; wp->hdop = le_readu16(p->hdop); wp->hdop /= 100; wp->vdop = le_readu16(p->vdop); @@ -2273,7 +2273,7 @@ delbin_list_units() } static void -delbin_rw_init(const char *fname) +delbin_rw_init(const char* fname) { message_t m; char buf[256]; @@ -2302,7 +2302,7 @@ delbin_rw_init(const char *fname) m.size = 0; message_write(MSG_VERSION, &m); if (message_read(MSG_VERSION, &m)) { - const msg_version_t* p = m.data; + const msg_version_t* p = (const msg_version_t*) m.data; if (global_opts.debug_level >= DBGLVL_L) { warning(MYNAME ": device %s %s\n", p->product, p->firmware); } @@ -2369,7 +2369,7 @@ delbin_write(void) message_init_size(&m, 0); message_write(MSG_CAPABILITIES, &m); if (message_read(MSG_CAPABILITIES, &m)) { - const msg_capabilities_t* p = m.data; + const msg_capabilities_t* p = (const msg_capabilities_t*) m.data; device_max_waypoint = le_readu32(p->max_waypoints); } message_free(&m); @@ -2646,9 +2646,9 @@ mac_os_init(const char* fname) fatal(MYNAME ": createAsyncEventSource failed 0x%x\n", (int)ir); } delbin_os_packet_size = 64; - report_buf = xmalloc(delbin_os_packet_size); + report_buf = (char*)xmalloc(delbin_os_packet_size); for (i = sizeofarray(packet_array); i--;) { - packet_array[i] = xmalloc(delbin_os_packet_size); + packet_array[i] = (char*)xmalloc(delbin_os_packet_size); } ir = (*device)->setInterruptReportHandlerCallback( device, report_buf, delbin_os_packet_size, interrupt_report_cb, NULL, NULL); diff --git a/gpsbabel/delgpl.c b/gpsbabel/delgpl.c index 3a6991769..881616caa 100644 --- a/gpsbabel/delgpl.c +++ b/gpsbabel/delgpl.c @@ -38,11 +38,11 @@ typedef struct gpl_point { unsigned int dummy3; } gpl_point_t; -static gbfile *gplfile_in; -static gbfile *gplfile_out; +static gbfile* gplfile_in; +static gbfile* gplfile_out; static void -gpl_rd_init(const char *fname) +gpl_rd_init(const char* fname) { gplfile_in = gbfopen_le(fname, "rb", MYNAME); if (sizeof(struct gpl_point) != 56) { @@ -54,8 +54,8 @@ gpl_rd_init(const char *fname) static void gpl_read(void) { - waypoint *wpt_tmp; - route_head *track_head; + waypoint* wpt_tmp; + route_head* track_head; gpl_point_t gp; double alt_feet; @@ -109,7 +109,7 @@ gpl_rd_deinit(void) } static void -gpl_wr_init(const char *fname) +gpl_wr_init(const char* fname) { gplfile_out = gbfopen_le(fname, "wb", MYNAME); } @@ -121,7 +121,7 @@ gpl_wr_deinit(void) } static void -gpl_trackpt(const waypoint *wpt) +gpl_trackpt(const waypoint* wpt) { double alt_feet = METERS_TO_FEET(wpt->altitude); int status = 3; @@ -166,7 +166,7 @@ gpl_write(void) ff_vecs_t gpl_vecs = { ff_type_file, - { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none }, + { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none }, gpl_rd_init, gpl_wr_init, gpl_rd_deinit, diff --git a/gpsbabel/destinator.c b/gpsbabel/destinator.c index 1f0e5b97a..34dc4e39e 100644 --- a/gpsbabel/destinator.c +++ b/gpsbabel/destinator.c @@ -39,7 +39,7 @@ arglist_t destinator_args[] = { ARG_TERMINATOR }; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static gpsdata_type data_type; @@ -47,37 +47,37 @@ static gpsdata_type data_type; /* READER */ /*-----------------------------------------------------------------------------*/ -static garmin_fs_t * -gmsd_init(waypoint *wpt) +static garmin_fs_t* +gmsd_init(waypoint* wpt) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } return gmsd; } -static char * +static char* read_wcstr(const int discard) { - gbint16 *buff = NULL, c; + gbint16* buff = NULL, c; int size = 0, pos = 0; while (gbfread(&c, sizeof(c), 1, fin) && (c != 0)) { if (size == 0) { size = 16; - buff = xmalloc(size * sizeof(*buff)); + buff = (gbint16*) xmalloc(size * sizeof(*buff)); } else if (pos == size) { size += 16; - buff = xrealloc(buff, size * sizeof(*buff)); + buff = (gbint16*) xrealloc(buff, size * sizeof(*buff)); } buff[pos] = c; pos += 1; } if (pos != 0) { - char *res; + char* res; if (discard) { res = NULL; } else { @@ -96,26 +96,26 @@ read_wcstr(const int discard) } static void -write_wcstr(const char *str) +write_wcstr(const char* str) { int len; - short *unicode; + short* unicode; unicode = cet_str_utf8_to_uni(str, &len); - gbfwrite((void *)unicode, 2, len + 1, fout); + gbfwrite((void*)unicode, 2, len + 1, fout); xfree(unicode); } static int -read_until_wcstr(const char *str) +read_until_wcstr(const char* str) { - char *buff; + char* buff; int len, sz; int eos = 0, res = 0; len = strlen(str); sz = (len + 1) * 2; - buff = xcalloc(sz, 1); + buff = (char*) xcalloc(sz, 1); while (! gbfeof(fin)) { @@ -126,7 +126,7 @@ read_until_wcstr(const char *str) if (c == 0) { eos++; if (eos >= 2) { /* two or more zero bytes => end of string */ - char *test = cet_str_uni_to_utf8((short *)buff, len); + char* test = cet_str_uni_to_utf8((short*)buff, len); if (test) { res = (strcmp(str, test) == 0); xfree(test); @@ -146,15 +146,15 @@ read_until_wcstr(const char *str) static void destinator_read_poi(void) { - waypoint *wpt; + waypoint* wpt; int count = 0; gbfrewind(fin); while (!(gbfeof(fin))) { - char *str, *hnum; + char* str, *hnum; double ll; - garmin_fs_t *gmsd; + garmin_fs_t* gmsd; if (count == 0) { str = read_wcstr(0); @@ -228,13 +228,13 @@ static void destinator_read_rte(void) { int count = 0; - route_head *rte = NULL; + route_head* rte = NULL; gbfrewind(fin); while (!(gbfeof(fin))) { - char *str; - waypoint *wpt; + char* str; + waypoint* wpt; if (count == 0) { str = read_wcstr(0); @@ -282,12 +282,12 @@ destinator_read_trk(void) { char TXT[4] = "TXT"; int recno = -1; - route_head *trk = NULL; + route_head* trk = NULL; gbfrewind(fin); while (!(gbfeof(fin))) { - waypoint *wpt; + waypoint* wpt; struct tm tm; char buff[20]; int date; @@ -309,7 +309,7 @@ destinator_read_trk(void) (void) gbfgetdbl(fin); /* unknown */ (void) gbfgetdbl(fin); /* unknown */ - wpt->fix = gbfgetint32(fin); + wpt->fix = (fix_type) gbfgetint32(fin); wpt->sat = gbfgetint32(fin); gbfseek(fin, 12 * sizeof(gbint32), SEEK_CUR); /* SAT info */ @@ -388,9 +388,9 @@ destinator_read(void) /*-----------------------------------------------------------------------------*/ static void -destinator_wpt_disp(const waypoint *wpt) +destinator_wpt_disp(const waypoint* wpt) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); write_wcstr(DST_DYN_POI); write_wcstr((wpt->shortname) ? wpt->shortname : "WPT"); @@ -416,7 +416,7 @@ destinator_wpt_disp(const waypoint *wpt) } static void -destinator_trkpt_disp(const waypoint *wpt) +destinator_trkpt_disp(const waypoint* wpt) { int i; @@ -461,7 +461,7 @@ destinator_trkpt_disp(const waypoint *wpt) } static void -destinator_rtept_disp(const waypoint *wpt) +destinator_rtept_disp(const waypoint* wpt) { write_wcstr(DST_ITINERARY); write_wcstr((wpt->shortname) ? wpt->shortname : "RTEPT"); @@ -485,7 +485,7 @@ destinator_rtept_disp(const waypoint *wpt) *******************************************************************************/ static void -destinator_rd_init(const char *fname) +destinator_rd_init(const char* fname) { fin = gbfopen_le(fname, "rb", MYNAME); } @@ -518,7 +518,7 @@ destinator_read_trk_wrapper(void) } static void -destinator_wr_init(const char *fname) +destinator_wr_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); } @@ -552,7 +552,7 @@ destinator_write_trk(void) ff_vecs_t destinator_poi_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, ff_cap_none /* routes */ }, @@ -572,7 +572,7 @@ ff_vecs_t destinator_itn_vecs = { { ff_cap_none /* waypoints */, ff_cap_none /* tracks */, - ff_cap_read | ff_cap_write /* routes */ + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */ }, destinator_rd_init, destinator_wr_init, @@ -589,7 +589,7 @@ ff_vecs_t destinator_trl_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, destinator_rd_init, diff --git a/gpsbabel/dg-100.c b/gpsbabel/dg-100.c index 2ae816fcd..185814016 100644 --- a/gpsbabel/dg-100.c +++ b/gpsbabel/dg-100.c @@ -35,7 +35,7 @@ #define MYNAME "DG-100" -static void *serial_handle; +static void* serial_handle; /* maximum frame size observed so far: 1817 bytes * (dg100cmd_getfileheader returning 150 entries) @@ -59,7 +59,7 @@ struct dg100_command { int sendsize; int recvsize; int trailing_bytes; - const char *text; /* Textual description for debugging */ + const char* text; /* Textual description for debugging */ }; struct dg100_command dg100_commands[] = { @@ -78,11 +78,11 @@ const unsigned dg100_numcommands = sizeof(dg100_commands) / sizeof(dg100_command struct dynarray16 { unsigned count; /* number of elements used */ unsigned limit; /* number of elements allocated */ - gbint16 *data; + gbint16* data; }; /* helper functions */ -static struct dg100_command * +static struct dg100_command* dg100_findcmd(int id) { unsigned int i; @@ -97,15 +97,15 @@ dg100_findcmd(int id) { } static void -dynarray16_init(struct dynarray16 *a, unsigned limit) +dynarray16_init(struct dynarray16* a, unsigned limit) { a->count = 0; a->limit = limit; - a->data = xmalloc(sizeof(a->data[0]) * a->limit); + a->data = (gbint16*) xmalloc(sizeof(a->data[0]) * a->limit); } -static gbint16 * -dynarray16_alloc(struct dynarray16 *a, unsigned n) +static gbint16* +dynarray16_alloc(struct dynarray16* a, unsigned n) { unsigned oldcount, need; const unsigned elements_per_chunk = 4096 / sizeof(a->data[0]); @@ -117,7 +117,7 @@ dynarray16_alloc(struct dynarray16 *a, unsigned n) need = a->count - a->limit; need = (need > elements_per_chunk) ? need : elements_per_chunk; a->limit += need; - a->data = xrealloc(a->data, sizeof(a->data[0]) * a->limit); + a->data = (gbint16*) xrealloc(a->data, sizeof(a->data[0]) * a->limit); } return(a->data + oldcount); } @@ -147,7 +147,7 @@ bintime2utc(int date, int time) } static void -dg100_debug(const char *hdr, int include_nl, size_t sz, unsigned char *buf) +dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf) { unsigned int i; @@ -168,7 +168,7 @@ dg100_debug(const char *hdr, int include_nl, size_t sz, unsigned char *buf) } static void -dg100_log(const char *fmt, ...) +dg100_log(const char* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -210,12 +210,12 @@ bin2deg(int val) } static void -process_gpsfile(gbuint8 data[], route_head *track) +process_gpsfile(gbuint8 data[], route_head* track) { const int recordsizes[3] = {8, 20, 32}; int i, style, recsize; int lat, lon, bintime, bindate; - waypoint *wpt; + waypoint* wpt; /* the first record of each file is always full-sized; its style field * determines the format of all subsequent records in the file */ @@ -276,7 +276,7 @@ dg100_checksum(gbuint8 buf[], int count) /* communication functions */ static size_t -dg100_send(gbuint8 cmd, const void *payload, size_t count) +dg100_send(gbuint8 cmd, const void* payload, size_t count) { gbuint8 frame[FRAME_MAXLEN]; gbuint16 checksum, payload_len; @@ -308,7 +308,7 @@ dg100_send(gbuint8 cmd, const void *payload, size_t count) n = gbser_write(serial_handle, frame, framelen); if (global_opts.debug_level) { - struct dg100_command *cmdp = dg100_findcmd(cmd); + struct dg100_command* cmdp = dg100_findcmd(cmd); dg100_debug(n == 0 ? "Sent: " : "Error Sending:", 1, framelen, frame); @@ -343,7 +343,7 @@ dg100_recv_byte() * framing around the data), so the caller must copy the data before calling * this function again */ static int -dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload) +dg100_recv_frame(struct dg100_command** cmdinfo_result, gbuint8** payload) { static gbuint8 buf[FRAME_MAXLEN]; gbuint16 frame_start_seq, payload_len_field; @@ -351,7 +351,7 @@ dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload) gbuint16 frame_head, numheaders, sum; gbuint8 c, cmd; int i, param_len, frame_len; - struct dg100_command *cmdinfo; + struct dg100_command* cmdinfo; /* consume input until frame head sequence 0xA0A2 was received */ frame_head = 0; @@ -469,11 +469,11 @@ dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload) /* return value: number of bytes copied into buf, -1 on error */ static int -dg100_recv(gbuint8 expected_id, void *buf, unsigned int len) +dg100_recv(gbuint8 expected_id, void* buf, unsigned int len) { int n; - struct dg100_command *cmdinfo; - gbuint8 *data; + struct dg100_command* cmdinfo; + gbuint8* data; unsigned int copysize, trailing_bytes; n = dg100_recv_frame(&cmdinfo, &data); @@ -500,11 +500,11 @@ dg100_recv(gbuint8 expected_id, void *buf, unsigned int len) /* the number of bytes to be sent is determined by cmd, * count is the size of recvbuf */ static int -dg100_request(gbuint8 cmd, const void *sendbuf, void *recvbuf, size_t count) +dg100_request(gbuint8 cmd, const void* sendbuf, void* recvbuf, size_t count) { - struct dg100_command *cmdinfo; + struct dg100_command* cmdinfo; int n, i, frames, fill; - gbuint8 *buf; + gbuint8* buf; cmdinfo = dg100_findcmd(cmd); assert(cmdinfo != NULL); @@ -513,7 +513,7 @@ dg100_request(gbuint8 cmd, const void *sendbuf, void *recvbuf, size_t count) /* the number of frames the answer will comprise */ frames = (cmd == dg100cmd_getfile) ? 2 : 1; /* alias pointer for easy typecasting */ - buf = recvbuf; + buf = (gbuint8*) recvbuf; fill = 0; for (i = 0; i < frames; i++) { n = dg100_recv(cmd, buf + fill, count - fill); @@ -527,7 +527,7 @@ dg100_request(gbuint8 cmd, const void *sendbuf, void *recvbuf, size_t count) /* higher level communication functions */ static void -dg100_getfileheaders(struct dynarray16 *headers) +dg100_getfileheaders(struct dynarray16* headers) { gbuint8 request[2]; gbuint8 answer[FRAME_MAXLEN]; @@ -568,7 +568,7 @@ dg100_getfileheaders(struct dynarray16 *headers) } static void -dg100_getfile(gbint16 num, route_head *track) +dg100_getfile(gbint16 num, route_head* track) { gbuint8 request[2]; gbuint8 answer[2048]; @@ -584,7 +584,7 @@ dg100_getfiles() unsigned int i; int filenum; struct dynarray16 headers; - route_head *track; + route_head* track; track = route_head_alloc(); track->rte_name = xstrdup("DG-100 tracklog"); @@ -619,8 +619,8 @@ dg100_erase() /* GPSBabel integration */ -static char *erase; -static char *erase_only; +static char* erase; +static char* erase_only; static arglist_t dg100_args[] = { @@ -640,7 +640,7 @@ arglist_t dg100_args[] = { *******************************************************************************/ static void -dg100_rd_init(const char *fname) +dg100_rd_init(const char* fname) { if (serial_handle = gbser_init(fname), NULL == serial_handle) { fatal(MYNAME ": Can't open port '%s'\n", fname); diff --git a/gpsbabel/discard.c b/gpsbabel/discard.c index 05c93fe51..fae159299 100644 --- a/gpsbabel/discard.c +++ b/gpsbabel/discard.c @@ -23,21 +23,21 @@ #include "filterdefs.h" #if FILTERS_ENABLED -static char *hdopopt = NULL; -static char *vdopopt = NULL; -static char *andopt = NULL; -static char *satopt = NULL; -static char *fixnoneopt = NULL; -static char *fixunknownopt = NULL; -static char *eleminopt = NULL; -static char *elemaxopt = NULL; +static char* hdopopt = NULL; +static char* vdopopt = NULL; +static char* andopt = NULL; +static char* satopt = NULL; +static char* fixnoneopt = NULL; +static char* fixunknownopt = NULL; +static char* eleminopt = NULL; +static char* elemaxopt = NULL; static double hdopf; static double vdopf; static int satpf; static int eleminpf; static int elemaxpf; static gpsdata_type what; -static route_head *head; +static route_head* head; static arglist_t fix_args[] = { @@ -80,13 +80,13 @@ arglist_t fix_args[] = { * Decide whether to keep or toss this point. */ static void -fix_process_wpt(const waypoint *wpt) +fix_process_wpt(const waypoint* wpt) { int del = 0; int delh = 0; int delv = 0; - waypoint *waypointp = (waypoint *) wpt; + waypoint* waypointp = (waypoint*) wpt; if ((hdopf >= 0.0) && (waypointp->hdop > hdopf)) { delh = 1; @@ -140,9 +140,9 @@ fix_process_wpt(const waypoint *wpt) } static void -fix_process_head(const route_head *trk) +fix_process_head(const route_head* trk) { - head = (route_head *)trk; + head = (route_head*)trk; } static void @@ -163,7 +163,7 @@ fix_process(void) } static void -fix_init(const char *args) +fix_init(const char* args) { if (hdopopt) { hdopf = atof(hdopopt); diff --git a/gpsbabel/dmtlog.c b/gpsbabel/dmtlog.c index 31fdf1502..762076383 100644 --- a/gpsbabel/dmtlog.c +++ b/gpsbabel/dmtlog.c @@ -32,12 +32,12 @@ #define DEFLATE_BUFF_SIZE 16384 -static gbfile *fin, *fout; +static gbfile* fin, *fout; -static char *xmlbin; -static waypoint *xmlwpt; -static route_head *xmltrk; -static char *xmlgrid; +static char* xmlbin; +static waypoint* xmlwpt; +static route_head* xmltrk; +static char* xmlgrid; static int xmldatum; static double xmlEasting, xmlNorthing; static double xmlLatitude, xmlLongitude; @@ -48,7 +48,7 @@ static int xmlbinsize; #endif static char header_written; -static char *opt_index; +static char* opt_index; static int track_index, this_index; static @@ -68,7 +68,7 @@ static xg_tag_mapping tlog3a_xgcb_map[] = { { tlog3a_xgcb_version, cb_cdata, "/CXMLSafe/Version" }, { tlog3a_xgcb_length, cb_cdata, "/CXMLSafe/Length" }, { tlog3a_xgcb_data, cb_cdata, "/CXMLSafe/Data" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; #endif @@ -99,13 +99,13 @@ static xg_tag_mapping tlog3b_xgcb_map[] = { { tlog3b_xgcb_wptno, cb_cdata, "/CTrackFile/CTrackPoint/Northing" }, { tlog3b_xgcb_wptal, cb_cdata, "/CTrackFile/CTrackPoint/Altitude" }, { tlog3b_xgcb_tpten, cb_end, "/CTrackFile/CTrackPoint" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; /* helpers */ static void -convert_datum(waypoint *wpt, int datum) +convert_datum(waypoint* wpt, int datum) { if (datum != DATUM_WGS84) { double lat = wpt->latitude; @@ -119,7 +119,7 @@ convert_datum(waypoint *wpt, int datum) static void -finalize_pt(waypoint *wpt) +finalize_pt(waypoint* wpt) { if (strcmp(xmlgrid, "BNG") == 0) { GPS_Math_NGENToAiry1830LatLon(xmlEasting, xmlNorthing, @@ -146,7 +146,7 @@ finalize_pt(waypoint *wpt) #if !ZLIB_INHIBITED static void -tlog3a_xgcb_version(const char *args, const char **unused) +tlog3a_xgcb_version(const char* args, const char** unused) { if (strcmp(args, "1") != 0) { fatal(MYNAME ": Unsupported file version '%s'!\n", args); @@ -154,22 +154,22 @@ tlog3a_xgcb_version(const char *args, const char **unused) } static void -tlog3a_xgcb_length(const char *args, const char **unused) +tlog3a_xgcb_length(const char* args, const char** unused) { } static void -tlog3a_xgcb_data(const char *args, const char **unused) +tlog3a_xgcb_data(const char* args, const char** unused) { int len; - char *bin; - char *cin, *cout; + char* bin; + char* cin, *cout; char cl, ch; len = strlen(args); - bin = xmalloc((len >> 1) + 1); + bin = (char*) xmalloc((len >> 1) + 1); - cin = (char *)args; + cin = (char*)args; cout = bin; cl = 0x10; @@ -203,7 +203,7 @@ tlog3a_xgcb_data(const char *args, const char **unused) static void -tlog3b_xgcb_tfna(const char *args, const char **unused) +tlog3b_xgcb_tfna(const char* args, const char** unused) { if (xmltrk == NULL) { xmltrk = route_head_alloc(); @@ -214,7 +214,7 @@ tlog3b_xgcb_tfna(const char *args, const char **unused) static void -tlog3b_xgcb_tfdes(const char *args, const char **unused) +tlog3b_xgcb_tfdes(const char* args, const char** unused) { if (xmltrk == NULL) { xmltrk = route_head_alloc(); @@ -225,7 +225,7 @@ tlog3b_xgcb_tfdes(const char *args, const char **unused) static void -tlog3b_xgcb_wptst(const char *args, const char **unused) +tlog3b_xgcb_wptst(const char* args, const char** unused) { xmlwpt = waypt_new(); xmldatum = DATUM_WGS84; @@ -233,7 +233,7 @@ tlog3b_xgcb_wptst(const char *args, const char **unused) static void -tlog3b_xgcb_tptst(const char *args, const char **unused) +tlog3b_xgcb_tptst(const char* args, const char** unused) { xmlwpt = waypt_new(); xmldatum = DATUM_WGS84; @@ -241,7 +241,7 @@ tlog3b_xgcb_tptst(const char *args, const char **unused) static void -tlog3b_xgcb_tpten(const char *args, const char **unused) +tlog3b_xgcb_tpten(const char* args, const char** unused) { finalize_pt(xmlwpt); @@ -255,7 +255,7 @@ tlog3b_xgcb_tpten(const char *args, const char **unused) static void -tlog3b_xgcb_wptid(const char *args, const char **unused) +tlog3b_xgcb_wptid(const char* args, const char** unused) { if (*args) { xmlwpt->shortname = xstrdup(args); @@ -264,14 +264,14 @@ tlog3b_xgcb_wptid(const char *args, const char **unused) static void -tlog3b_xgcb_wptdt(const char *args, const char **unused) +tlog3b_xgcb_wptdt(const char* args, const char** unused) { xmldatum = GPS_Lookup_Datum_Index(args); } static void -tlog3b_xgcb_wptgr(const char *args, const char **unused) +tlog3b_xgcb_wptgr(const char* args, const char** unused) { if (xmlgrid != NULL) { if (strcmp(xmlgrid, args) == 0) { @@ -284,35 +284,35 @@ tlog3b_xgcb_wptgr(const char *args, const char **unused) static void -tlog3b_xgcb_wptno(const char *args, const char **unused) +tlog3b_xgcb_wptno(const char* args, const char** unused) { xmlNorthing = atof(args); } static void -tlog3b_xgcb_wptea(const char *args, const char **unused) +tlog3b_xgcb_wptea(const char* args, const char** unused) { xmlEasting = atof(args); } static void -tlog3b_xgcb_wptal(const char *args, const char **unused) +tlog3b_xgcb_wptal(const char* args, const char** unused) { xmlAltitude = atof(args); } static void -tlog3b_xgcb_tptdt(const char *args, const char **unused) +tlog3b_xgcb_tptdt(const char* args, const char** unused) { xmldatum = GPS_Lookup_Datum_Index(args); } static void -tlog3b_xgcb_wpten(const char *args, const char **unused) +tlog3b_xgcb_wpten(const char* args, const char** unused) { finalize_pt(xmlwpt); waypt_add(xmlwpt); @@ -320,18 +320,18 @@ tlog3b_xgcb_wpten(const char *args, const char **unused) } -static char * -read_str(gbfile *f) +static char* +read_str(gbfile* f) { int i; - char *res; + char* res; i = gbfgetc(f); if (i == 0xff) { i = gbfgetint16(f); } - res = xmalloc(i + 1); + res = (char*) xmalloc(i + 1); res[i] = '\0'; if (i) { gbfread(res, 1, i, f); @@ -341,7 +341,7 @@ read_str(gbfile *f) } static void -write_str(const char *str, gbfile *f) +write_str(const char* str, gbfile* f) { if (str && *str) { int len = strlen(str); @@ -366,10 +366,10 @@ write_str(const char *str, gbfile *f) } static int -read_datum(gbfile *f) +read_datum(gbfile* f) { int res; - char *d, *g; + char* d, *g; d = read_str(f); g = read_str(f); @@ -395,7 +395,7 @@ read_CTrackFile(const int version) gbint32 tcount, wcount; gbint16 u1; gbint32 ux; - route_head *track; + route_head* track; int i; int datum; @@ -424,7 +424,7 @@ read_CTrackFile(const int version) /* S1 .. S9: comments, hints, jokes, aso */ for (i = 0; i < 9; i++) { - char *s = read_str(fin); + char* s = read_str(fin); xfree(s); } @@ -441,7 +441,7 @@ read_CTrackFile(const int version) } while (tcount > 0) { - waypoint *wpt; + waypoint* wpt; tcount--; @@ -485,7 +485,7 @@ read_CTrackFile(const int version) } while (! gbfeof(fin)) { - waypoint *wpt; + waypoint* wpt; i = gbfgetc(fin); if (i == 0) { @@ -520,7 +520,7 @@ read_CTrackFile(const int version) datum = read_datum(fin); while (wcount > 0) { - waypoint *wpt; + waypoint* wpt; gbint32 namect, i; wcount--; @@ -538,7 +538,7 @@ read_CTrackFile(const int version) // variants of shortname for (i = 0; i < namect; i++) { - char *name; + char* name; name = read_str(fin); if (name && *name) { @@ -562,12 +562,12 @@ read_CTrackFile(const int version) #if !ZLIB_INHIBITED static int -inflate_buff(const char *buff, const size_t size, char **out_buff) +inflate_buff(const char* buff, const size_t size, char** out_buff) { int res = Z_OK; z_stream strm; char out[DEFLATE_BUFF_SIZE]; - char *cout = NULL; + char* cout = NULL; gbuint32 bytes = 0; gbuint32 have; @@ -583,11 +583,11 @@ inflate_buff(const char *buff, const size_t size, char **out_buff) } strm.avail_in = size; - strm.next_in = (void *)buff; + strm.next_in = (Bytef*)buff; do { strm.avail_out = DEFLATE_BUFF_SIZE; - strm.next_out = (void *)out; + strm.next_out = (Bytef*)out; res = inflate(&strm, Z_NO_FLUSH); switch (res) { @@ -600,7 +600,7 @@ inflate_buff(const char *buff, const size_t size, char **out_buff) } have = DEFLATE_BUFF_SIZE - strm.avail_out; if (have > 0) { - cout = xrealloc(cout, bytes + have); + cout = (char*) xrealloc(cout, bytes + have); memcpy(cout+bytes, out, have); bytes+=have; } @@ -614,7 +614,7 @@ inflate_buff(const char *buff, const size_t size, char **out_buff) static void read_CXMLSafe(void) { - char *xmlstr = NULL; + char* xmlstr = NULL; xmlbin = NULL; xmlbinsize = 0; @@ -652,7 +652,7 @@ read_XML(void) *******************************************************************************/ static void -dmtlog_rd_init(const char *fname) +dmtlog_rd_init(const char* fname) { fin = gbfopen_le(fname, "rb", MYNAME); @@ -701,7 +701,7 @@ dmtlog_read(void) } static void -dmtlog_wr_init(const char *fname) +dmtlog_wr_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); } @@ -713,17 +713,17 @@ dmtlog_wr_deinit(void) } static void -write_header(const route_head *trk) +write_header(const route_head* trk) { int count, i; - char *cout; + char* cout; const char ZERO = '\0'; header_written = 1; count = 0; if (trk != NULL) { - queue *curr, *prev; + queue* curr, *prev; QUEUE_FOR_EACH(&trk->waypoint_list, curr, prev) count++; } write_str(trk && trk->rte_name && *trk->rte_name ? trk->rte_name : "Name", fout); @@ -744,7 +744,7 @@ write_header(const route_head *trk) } static void -track_hdr_cb(const route_head *trk) +track_hdr_cb(const route_head* trk) { this_index++; @@ -755,12 +755,12 @@ track_hdr_cb(const route_head *trk) } static void -track_tlr_cb(const route_head *trk) +track_tlr_cb(const route_head* trk) { } static void -track_wpt_cb(const waypoint *wpt) +track_wpt_cb(const waypoint* wpt) { if (this_index != track_index) { return; @@ -772,7 +772,7 @@ track_wpt_cb(const waypoint *wpt) } static void -wpt_cb(const waypoint *wpt) +wpt_cb(const waypoint* wpt) { int names; @@ -824,8 +824,8 @@ dmtlog_write(void) ff_vecs_t dmtlog_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, dmtlog_rd_init, diff --git a/gpsbabel/duplicate.c b/gpsbabel/duplicate.c index 117717303..bca2779ad 100644 --- a/gpsbabel/duplicate.c +++ b/gpsbabel/duplicate.c @@ -23,10 +23,10 @@ #include "filterdefs.h" #if FILTERS_ENABLED -static char *snopt = NULL; -static char *lcopt = NULL; -static char *purge_duplicates = NULL; -static char *correct_coords = NULL; +static char* snopt = NULL; +static char* lcopt = NULL; +static char* purge_duplicates = NULL; +static char* correct_coords = NULL; static arglist_t dup_args[] = { @@ -51,15 +51,15 @@ arglist_t dup_args[] = { typedef struct btree_node { - struct btree_node *left, *right; + struct btree_node* left, *right; unsigned long data; - waypoint *wpt; + waypoint* wpt; } btree_node; -static btree_node * -addnode(btree_node * tree, btree_node * newnode, btree_node **oldnode) +static btree_node* +addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode) { - btree_node * tmp, * last = NULL; + btree_node* tmp, * last = NULL; if (*oldnode) { *oldnode = NULL; @@ -95,7 +95,7 @@ addnode(btree_node * tree, btree_node * newnode, btree_node **oldnode) } void -free_tree(btree_node *tree) +free_tree(btree_node* tree) { if (tree->left) { free_tree(tree->left); @@ -107,7 +107,7 @@ free_tree(btree_node *tree) } typedef struct { - waypoint *wpt; + waypoint* wpt; int index; } wpt_ptr; @@ -147,10 +147,10 @@ because, sadly, quicksort can be O(n^2) on presorted elements.) static int -compare(const void *a, const void *b) +compare(const void* a, const void* b) { - const wpt_ptr *wa = (wpt_ptr *)a; - const wpt_ptr *wb = (wpt_ptr *)b; + const wpt_ptr* wa = (wpt_ptr*)a; + const wpt_ptr* wb = (wpt_ptr*)b; if (wa->wpt->gc_data->exported < wb->wpt->gc_data->exported) { return 1; @@ -174,27 +174,27 @@ compare(const void *a, const void *b) static void duplicate_process(void) { - waypoint * waypointp; - btree_node * newnode, * btmp, * sup_tree = NULL; - btree_node * oldnode = NULL; + waypoint* waypointp; + btree_node* newnode, * btmp, * sup_tree = NULL; + btree_node* oldnode = NULL; unsigned long crc = 0; struct { char shortname[32]; char lat[13]; char lon[13]; } dupe; - waypoint * delwpt = NULL; + waypoint* delwpt = NULL; int i, ct = waypt_count(); - wpt_ptr *htable, *bh; - queue *elem, *tmp; + wpt_ptr* htable, *bh; + queue* elem, *tmp; - htable = (wpt_ptr *) xmalloc(ct * sizeof(*htable)); + htable = (wpt_ptr*) xmalloc(ct * sizeof(*htable)); bh = htable; i = 0; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - bh->wpt = (waypoint *) elem; + bh->wpt = (waypoint*) elem; bh->index = i; i ++; bh ++; @@ -225,7 +225,7 @@ duplicate_process(void) crc = get_crc32(&dupe, sizeof(dupe)); - newnode = (btree_node *)xcalloc(sizeof(btree_node), 1); + newnode = (btree_node*)xcalloc(sizeof(btree_node), 1); newnode->data = crc; newnode->wpt = waypointp; diff --git a/gpsbabel/easygps.c b/gpsbabel/easygps.c index e9b71d2fb..1cdc3820e 100644 --- a/gpsbabel/easygps.c +++ b/gpsbabel/easygps.c @@ -22,8 +22,8 @@ #include "defs.h" #include -static gbfile *file_in; -static gbfile *file_out; +static gbfile* file_in; +static gbfile* file_out; static short_handle mkshort_handle; /* static char *deficon = NULL; */ @@ -37,11 +37,11 @@ arglist_t easygps_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { int sz; char ibuf[100] = {'0'} ; - const char *ezsig = "TerraByte Location File"; + const char* ezsig = "TerraByte Location File"; file_in = gbfopen_le(fname, "rb", MYNAME); @@ -61,7 +61,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -81,7 +81,7 @@ data_read(void) char ibuf[10]; do { unsigned char tag; - waypoint *wpt_tmp; + waypoint* wpt_tmp; wpt_tmp = waypt_new(); @@ -142,7 +142,7 @@ data_read(void) static void -ez_disp(const waypoint *wpt) +ez_disp(const waypoint* wpt) { gbfputc('W', file_out); diff --git a/gpsbabel/enigma.c b/gpsbabel/enigma.c index 7b408f9ce..2d6c8d748 100755 --- a/gpsbabel/enigma.c +++ b/gpsbabel/enigma.c @@ -71,10 +71,10 @@ typedef struct enigma_wpt { char longname[27]; } ENIGMA_WPT; -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -102,11 +102,11 @@ static void data_read(void) { struct enigma_wpt ewpt; - route_head *route = route_head_alloc(); + route_head* route = route_head_alloc(); route_add_head(route); while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude)); wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude)); wpt->shortname = xstrndup(ewpt.shortname, ewpt.shortname_len); @@ -146,13 +146,13 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); } static void -route_head_noop(const route_head *wp) +route_head_noop(const route_head* wp) { } @@ -164,7 +164,7 @@ route_head_noop(const route_head *wp) #endif static void -enigma_waypt_disp(const waypoint *wpt) +enigma_waypt_disp(const waypoint* wpt) { struct enigma_wpt ewpt; @@ -202,9 +202,9 @@ wr_deinit(void) ff_vecs_t enigma_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write, /* waypoints */ + (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */ ff_cap_none, /* tracks */ - ff_cap_read | ff_cap_write /* routes */ + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */ }, rd_init, wr_init, diff --git a/gpsbabel/exif.c b/gpsbabel/exif.c index 30d196279..2876d4c4d 100644 --- a/gpsbabel/exif.c +++ b/gpsbabel/exif.c @@ -104,7 +104,7 @@ typedef struct exif_tag_s { gbuint32 offs; #endif unsigned char data_is_dynamic:1; - void *data; + void* data; } exif_tag_t; typedef struct exif_ifd_s { @@ -119,20 +119,20 @@ typedef struct exif_app_s { queue Q; gbuint16 marker; gbsize_t len; - gbfile *fcache; - gbfile *fexif; + gbfile* fcache; + gbfile* fexif; queue ifds; } exif_app_t; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static queue exif_apps; -static exif_app_t *exif_app; -const waypoint *exif_wpt_ref; +static exif_app_t* exif_app; +const waypoint* exif_wpt_ref; time_t exif_time_ref; static char exif_success; -static char *exif_fout_name; +static char* exif_fout_name; -static char *opt_filename, *opt_overwrite, *opt_frame, *opt_name; +static char* opt_filename, *opt_overwrite, *opt_frame, *opt_name; arglist_t exif_args[] = { { "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX }, @@ -144,7 +144,7 @@ arglist_t exif_args[] = { #ifdef EXIF_DBG static void -print_buff(const char *buf, int sz, const char *cmt) +print_buff(const char* buf, int sz, const char* cmt) { int i; @@ -203,11 +203,11 @@ exif_type_size(const gbuint16 type) return size; } -static char * +static char* exif_time_str(const time_t time) { struct tm tm; - char *res; + char* res; tm = *localtime(&time); tm.tm_year += 1900; @@ -218,20 +218,20 @@ exif_time_str(const time_t time) return res; } -static char * -exif_read_str(exif_tag_t *tag) +static char* +exif_read_str(exif_tag_t* tag) { // Panasonic DMC-TZ10 stores datum with trailing spaces. - char *buf = xstrndup((char *)tag->data, tag->size); + char* buf = xstrndup((char*)tag->data, tag->size); rtrim(buf); return buf; } static double -exif_read_double(const exif_tag_t *tag, const int index) +exif_read_double(const exif_tag_t* tag, const int index) { unsigned int num, den; - gbint32 *data = (void *)tag->data; + gbint32* data = (gbint32*)tag->data; num = data[index * 2]; den = data[(index * 2) + 1]; @@ -243,7 +243,7 @@ exif_read_double(const exif_tag_t *tag, const int index) } static double -exif_read_coord(const exif_tag_t *tag) +exif_read_coord(const exif_tag_t* tag) { double res, min, sec; @@ -265,7 +265,7 @@ exif_read_coord(const exif_tag_t *tag) } static time_t -exif_read_timestamp(const exif_tag_t *tag) +exif_read_timestamp(const exif_tag_t* tag) { double hour, min, sec; @@ -277,13 +277,13 @@ exif_read_timestamp(const exif_tag_t *tag) } static time_t -exif_read_datestamp(const exif_tag_t *tag) +exif_read_datestamp(const exif_tag_t* tag) { struct tm tm; - char *str; + char* str; memset(&tm, 0, sizeof(tm)); - str = xstrndup((char *)tag->data, tag->size); + str = xstrndup((char*)tag->data, tag->size); sscanf(str, "%d:%d:%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday); xfree(str); @@ -294,7 +294,7 @@ exif_read_datestamp(const exif_tag_t *tag) } static void -exif_release_tag(exif_tag_t *tag) +exif_release_tag(exif_tag_t* tag) { dequeue(&tag->Q); if (tag->data_is_dynamic) { @@ -304,13 +304,13 @@ exif_release_tag(exif_tag_t *tag) } static void -exif_release_ifd(exif_ifd_t *ifd) +exif_release_ifd(exif_ifd_t* ifd) { if (ifd != NULL) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_release_tag((exif_tag_t *)elem); + exif_release_tag((exif_tag_t*)elem); } xfree(ifd); } @@ -319,11 +319,11 @@ exif_release_ifd(exif_ifd_t *ifd) static void exif_release_apps(void) { - queue *e0, *t0; + queue* e0, *t0; QUEUE_FOR_EACH(&exif_apps, e0, t0) { - queue *e1, *t1; - exif_app_t *app = (exif_app_t *)dequeue(e0); + queue* e1, *t1; + exif_app_t* app = (exif_app_t*)dequeue(e0); if (app->fcache) { gbfclose(app->fcache); @@ -332,7 +332,7 @@ exif_release_apps(void) gbfclose(app->fexif); } QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t *ifd = (exif_ifd_t *)dequeue(e1); + exif_ifd_t* ifd = (exif_ifd_t*)dequeue(e1); exif_release_ifd(ifd); } xfree(app); @@ -340,14 +340,14 @@ exif_release_apps(void) } static gbuint32 -exif_ifd_size(exif_ifd_t *ifd) +exif_ifd_size(exif_ifd_t* ifd) { - queue *elem, *tmp; + queue* elem, *tmp; gbuint32 res = 6; /* nr of tags + next_ifd */ res += (ifd->count * 12); QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t *tag = (exif_tag_t *)elem; + exif_tag_t* tag = (exif_tag_t*)elem; if (tag->size > 4) { gbuint32 size = tag->size; if (size & 1) { @@ -360,13 +360,13 @@ exif_ifd_size(exif_ifd_t *ifd) return res; } -static exif_app_t * +static exif_app_t* exif_load_apps(void) { - exif_app_t *exif_app = NULL; + exif_app_t* exif_app = NULL; while (! gbfeof(fin)) { - exif_app_t *app = xcalloc(sizeof(*app), 1); + exif_app_t* app = (exif_app_t*) xcalloc(sizeof(*app), 1); ENQUEUE_TAIL(&exif_apps, &app->Q); QUEUE_INIT(&app->ifds); @@ -393,16 +393,16 @@ exif_load_apps(void) return exif_app; } -static exif_ifd_t * -exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, - gbuint32 *exif_ifd_ofs, gbuint32 *gps_ifd_ofs, gbuint32 *inter_ifd_ofs) +static exif_ifd_t* +exif_read_ifd(exif_app_t* app, const gbuint16 ifd_nr, gbsize_t offs, + gbuint32* exif_ifd_ofs, gbuint32* gps_ifd_ofs, gbuint32* inter_ifd_ofs) { - queue *elem, *tmp; + queue* elem, *tmp; gbuint16 i; - exif_ifd_t *ifd; - gbfile *fin = app->fexif; + exif_ifd_t* ifd; + gbfile* fin = app->fexif; - ifd = xcalloc(sizeof(*ifd), 1); + ifd = (exif_ifd_t*) xcalloc(sizeof(*ifd), 1); QUEUE_INIT(&ifd->tags); ENQUEUE_TAIL(&app->ifds, &ifd->Q); ifd->nr = ifd_nr; @@ -412,7 +412,7 @@ exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, #ifdef EXIF_DBG { - char *name; + char* name; switch (ifd_nr) { case IFD0: name = "IFD0"; @@ -442,10 +442,10 @@ exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, } for (i = 0; i < ifd->count; i++) { - exif_tag_t *tag; + exif_tag_t* tag; offs = gbftell(fin); - tag = xcalloc(sizeof(*tag), 1); + tag = (exif_tag_t*) xcalloc(sizeof(*tag), 1); ENQUEUE_TAIL(&ifd->tags, &tag->Q); @@ -481,15 +481,15 @@ exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, ifd->next_ifd = gbfgetuint16(fin); QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t *tag = (exif_tag_t *)elem; + exif_tag_t* tag = (exif_tag_t*)elem; if ((tag->size > 4) && (tag->value)) { gbuint16 i; - char *ptr; + char* ptr; tag->data = xmalloc(tag->size); tag->data_is_dynamic = 1; - ptr = tag->data; + ptr = (char*) tag->data; gbfseek(fin, tag->value, SEEK_SET); if (BYTE_TYPE(tag->type)) { @@ -498,23 +498,23 @@ exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, switch (tag->type) { case EXIF_TYPE_SHORT: case EXIF_TYPE_SSHORT: - *(gbint16 *)ptr = gbfgetuint16(fin); + *(gbint16*)ptr = gbfgetuint16(fin); break; case EXIF_TYPE_IFD: case EXIF_TYPE_LONG: case EXIF_TYPE_SLONG: - *(gbint32 *)ptr = gbfgetuint32(fin); + *(gbint32*)ptr = gbfgetuint32(fin); break; case EXIF_TYPE_RAT: case EXIF_TYPE_SRAT: - *(gbint32 *)ptr = gbfgetuint32(fin); - *(gbint32 *)(ptr+4) = gbfgetuint32(fin); + *(gbint32*)ptr = gbfgetuint32(fin); + *(gbint32*)(ptr+4) = gbfgetuint32(fin); break; case EXIF_TYPE_FLOAT: - *(float *)ptr = gbfgetflt(fin); + *(float*)ptr = gbfgetflt(fin); break; case EXIF_TYPE_DOUBLE: - *(double *)ptr = gbfgetdbl(fin); + *(double*)ptr = gbfgetdbl(fin); break; default: gbfread(ptr, 1, 1, fin); @@ -537,16 +537,16 @@ exif_read_ifd(exif_app_t *app, const gbuint16 ifd_nr, gbsize_t offs, } static void -exif_read_app(exif_app_t *app) +exif_read_app(exif_app_t* app) { gbsize_t offs; gbuint32 exif_ifd_ofs, gps_ifd_ofs, inter_ifd_ofs; - exif_ifd_t *ifd; - gbfile *fin = app->fexif; + exif_ifd_t* ifd; + gbfile* fin = app->fexif; #ifdef EXIF_DBG printf(MYNAME ": read_app...\n"); - print_buff((const char *)fin->handle.mem, 16, MYNAME); + print_buff((const char*)fin->handle.mem, 16, MYNAME); printf("\n"); #endif exif_ifd_ofs = gps_ifd_ofs = inter_ifd_ofs = 0; @@ -574,11 +574,11 @@ exif_read_app(exif_app_t *app) } static void -exif_examine_app(exif_app_t *app) +exif_examine_app(exif_app_t* app) { gbuint16 endianess; gbuint32 ident; - gbfile *ftmp = exif_app->fcache; + gbfile* ftmp = exif_app->fcache; int i; gbfrewind(ftmp); @@ -606,13 +606,13 @@ exif_examine_app(exif_app_t *app) exif_read_app(exif_app); } -static exif_ifd_t * -exif_find_ifd(exif_app_t *app, const gbuint16 ifd_nr) +static exif_ifd_t* +exif_find_ifd(exif_app_t* app, const gbuint16 ifd_nr) { - queue *e0, *t0; + queue* e0, *t0; QUEUE_FOR_EACH(&app->ifds, e0, t0) { - exif_ifd_t *ifd = (exif_ifd_t *)e0; + exif_ifd_t* ifd = (exif_ifd_t*)e0; if (ifd->nr == ifd_nr) { return ifd; @@ -621,14 +621,14 @@ exif_find_ifd(exif_app_t *app, const gbuint16 ifd_nr) return NULL; } -static exif_tag_t * -exif_find_tag(exif_app_t *app, const gbuint16 ifd_nr, const gbuint16 tag_id) +static exif_tag_t* +exif_find_tag(exif_app_t* app, const gbuint16 ifd_nr, const gbuint16 tag_id) { - exif_ifd_t *ifd = exif_find_ifd(app, ifd_nr); + exif_ifd_t* ifd = exif_find_ifd(app, ifd_nr); if (ifd != NULL) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t *tag = (exif_tag_t *)elem; + exif_tag_t* tag = (exif_tag_t*)elem; if (tag->id == tag_id) { return tag; } @@ -638,9 +638,9 @@ exif_find_tag(exif_app_t *app, const gbuint16 ifd_nr, const gbuint16 tag_id) } static time_t -exif_get_exif_time(exif_app_t *app) +exif_get_exif_time(exif_app_t* app) { - exif_tag_t *tag; + exif_tag_t* tag; time_t res = 0; tag = exif_find_tag(app, EXIF_IFD, 0x9003); /* DateTimeOriginal from EXIF */ @@ -652,7 +652,7 @@ exif_get_exif_time(exif_app_t *app) } if (tag) { struct tm tm; - char *c, *str; + char* c, *str; memset(&tm, 0, sizeof(tm)); str = exif_read_str(tag); @@ -666,18 +666,18 @@ exif_get_exif_time(exif_app_t *app) return res; } -static waypoint * -exif_waypt_from_exif_app(exif_app_t *app) +static waypoint* +exif_waypt_from_exif_app(exif_app_t* app) { - waypoint *wpt; - queue *elem, *tmp; - exif_ifd_t *ifd; - exif_tag_t *tag; + waypoint* wpt; + queue* elem, *tmp; + exif_ifd_t* ifd; + exif_tag_t* tag; char lat_ref = '\0'; char lon_ref = '\0'; char alt_ref = 0; char speed_ref = '\0'; - char *datum = NULL; + char* datum = NULL; char mode = '\0'; double gpsdop = unknown_alt; double alt = unknown_alt; @@ -695,25 +695,25 @@ exif_waypt_from_exif_app(exif_app_t *app) wpt->longitude = unknown_alt; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - tag = (exif_tag_t *)elem; + tag = (exif_tag_t*)elem; switch (tag->id) { case GPS_IFD_TAG_VERSION: break; case GPS_IFD_TAG_LATREF: - lat_ref = *(char *)tag->data; + lat_ref = *(char*)tag->data; break; case GPS_IFD_TAG_LAT: wpt->latitude = exif_read_coord(tag); break; case GPS_IFD_TAG_LONREF: - lon_ref = *(char *)tag->data; + lon_ref = *(char*)tag->data; break; case GPS_IFD_TAG_LON: wpt->longitude = exif_read_coord(tag); break; case GPS_IFD_TAG_ALTREF: - alt_ref = *(char *)tag->data; + alt_ref = *(char*)tag->data; break; case GPS_IFD_TAG_ALT: alt = exif_read_double(tag, 0); @@ -722,16 +722,16 @@ exif_waypt_from_exif_app(exif_app_t *app) timestamp = exif_read_timestamp(tag); break; case GPS_IFD_TAG_SAT: - wpt->sat = atoi((char *)tag->data); + wpt->sat = atoi((char*)tag->data); break; case GPS_IFD_TAG_MODE: - mode = *(char *)tag->data; + mode = *(char*)tag->data; break; case GPS_IFD_TAG_DOP: gpsdop = exif_read_double(tag, 0); break; case GPS_IFD_TAG_SPEEDREF: - speed_ref = *(char *)tag->data; + speed_ref = *(char*)tag->data; break; case GPS_IFD_TAG_SPEED: WAYPT_SET(wpt, speed, exif_read_double(tag, 0)); @@ -832,7 +832,7 @@ exif_waypt_from_exif_app(exif_app_t *app) } if (timestamp != UNKNOWN_TIMESTAMP) { #ifdef EXIF_DBG - char *str = exif_time_str(timestamp); + char* str = exif_time_str(timestamp); printf(MYNAME "-GPSTimeStamp = %s\n", str); xfree(str); #endif @@ -843,12 +843,12 @@ exif_waypt_from_exif_app(exif_app_t *app) tag = exif_find_tag(app, EXIF_IFD, EXIF_IFD_TAG_USER_CMT); /* UserComment */ if (tag && (tag->size > 8)) { - char *str = NULL; + char* str = NULL; if (memcmp(tag->data, "ASCII\0\0\0", 8) == 0) { - str = xstrndup((char *)tag->data + 8, tag->size - 8); + str = xstrndup((char*)tag->data + 8, tag->size - 8); } else if (memcmp(tag->data, "UNICODE\0", 8) == 0) { int i, len = (tag->size - 8) / 2; - gbint16 *s = (void *)((char *)tag->data + 8); + gbint16* s = (gbint16*)((char*)tag->data + 8); for (i = 0; i < len; i++) { s[i] = be_read16(&s[i]); /* always BE ? */ } @@ -860,8 +860,8 @@ exif_waypt_from_exif_app(exif_app_t *app) } if (opt_filename) { - char *c, *cx; - char *str = xstrdup(fin->name); + char* c, *cx; + char* str = xstrdup(fin->name); cx = str; if ((c = strrchr(cx, ':'))) { @@ -888,13 +888,13 @@ exif_waypt_from_exif_app(exif_app_t *app) } static void -exif_dec2frac(double val, gbint32 *num, gbint32 *den) +exif_dec2frac(double val, gbint32* num, gbint32* den) { char sval[16], snum[16]; char dot = 0; int den1 = 1; int num1, num2, den2, rem; - char *cx; + char* cx; double vx; if (val < 0.000000001) { @@ -950,16 +950,16 @@ exif_dec2frac(double val, gbint32 *num, gbint32 *den) *den = den1 / rem; } -static exif_tag_t * -exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, const gbuint32 count, const int index, const void *data) +static exif_tag_t* +exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, const gbuint32 count, const int index, const void* data) { - exif_tag_t *tag = NULL; - exif_ifd_t *ifd; + exif_tag_t* tag = NULL; + exif_ifd_t* ifd; gbuint16 item_size, size; ifd = exif_find_ifd(exif_app, ifd_nr); if (ifd == NULL) { - ifd = xcalloc(sizeof(*ifd), 1); + ifd = (exif_ifd_t*) xcalloc(sizeof(*ifd), 1); ifd->nr = ifd_nr; QUEUE_INIT(&ifd->tags); ENQUEUE_TAIL(&exif_app->ifds, &ifd->Q); @@ -980,7 +980,7 @@ exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, con return NULL; } - tag = xcalloc(sizeof(*tag), 1); + tag = (exif_tag_t*) xcalloc(sizeof(*tag), 1); tag->id = tag_id; tag->type = type; @@ -999,7 +999,7 @@ exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, con } if (tag->count < (index + count)) { if (! tag->data_is_dynamic) { - void *tmp = xmalloc(tag->size < 4 ? 4 : tag->size); + void* tmp = xmalloc(tag->size < 4 ? 4 : tag->size); memcpy(tmp, tag->data, tag->size); tag->data = tmp; tag->data_is_dynamic = 1; @@ -1013,8 +1013,8 @@ exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, con switch (type) { case EXIF_TYPE_RAT: case EXIF_TYPE_SRAT: { - double val = *(double *)data; - gbuint32 *dest = tag->data; + double val = *(double*)data; + gbuint32* dest = (gbuint32*) tag->data; if ((int)val == val) { dest[index * 2] = (int)val; @@ -1031,7 +1031,7 @@ exif_put_value(const int ifd_nr, const gbuint16 tag_id, const gbuint16 type, con } break; default: { - char *dest = tag->data; + char* dest = (char*) tag->data; memcpy(&dest[index * item_size], data, count * item_size); } } @@ -1048,7 +1048,7 @@ exif_put_double(const int ifd_nr, const int tag_id, const int index, const doubl static void -exif_put_str(const int ifd_nr, const int tag_id, const char *val) +exif_put_str(const int ifd_nr, const int tag_id, const char* val) { int len = (val) ? strlen(val) + 1 : 0; exif_put_value(ifd_nr, tag_id, EXIF_TYPE_ASCII, len, 0, val); @@ -1083,7 +1083,7 @@ exif_remove_tag(const int ifd_nr, const int tag_id) } static void -exif_find_wpt_by_time(const waypoint *wpt) +exif_find_wpt_by_time(const waypoint* wpt) { if (wpt->creation_time <= 0) { return; @@ -1097,7 +1097,7 @@ exif_find_wpt_by_time(const waypoint *wpt) } static void -exif_find_wpt_by_name(const waypoint *wpt) +exif_find_wpt_by_name(const waypoint* wpt) { if (exif_wpt_ref != NULL) { return; @@ -1108,40 +1108,40 @@ exif_find_wpt_by_name(const waypoint *wpt) static int -exif_sort_tags_cb(const queue *A, const queue *B) +exif_sort_tags_cb(const queue* A, const queue* B) { - exif_tag_t *ta = (exif_tag_t *)A; - exif_tag_t *tb = (exif_tag_t *)B; + exif_tag_t* ta = (exif_tag_t*)A; + exif_tag_t* tb = (exif_tag_t*)B; return ta->id - tb->id; } static int -exif_sort_ifds_cb(const queue *A, const queue *B) +exif_sort_ifds_cb(const queue* A, const queue* B) { - exif_ifd_t *ia = (exif_ifd_t *)A; - exif_ifd_t *ib = (exif_ifd_t *)B; + exif_ifd_t* ia = (exif_ifd_t*)A; + exif_ifd_t* ib = (exif_ifd_t*)B; return ia->nr - ib->nr; } static void -exif_write_value(exif_tag_t *tag, gbfile *fout) +exif_write_value(exif_tag_t* tag, gbfile* fout) { if (tag->size > 4) { gbfputuint32(tag->value, fout); /* offset to data */ } else { - char *data = tag->data; + char* data = (char*) tag->data; if BYTE_TYPE(tag->type) { gbfwrite(data, 4, 1, fout); } else if WORD_TYPE(tag->type) { - gbfputuint16(*(gbuint16 *)data, fout); - gbfputuint16(*(gbuint16 *)(data+2), fout); + gbfputuint16(*(gbuint16*)data, fout); + gbfputuint16(*(gbuint16*)(data+2), fout); } else if LONG_TYPE(tag->type) { - gbfputuint32(*(gbuint32 *)data, fout); + gbfputuint32(*(gbuint32*)data, fout); } else if (tag->type == EXIF_TYPE_FLOAT) { - gbfputflt(*(float *)data, fout); + gbfputflt(*(float*)data, fout); } else { fatal(MYNAME ": Unknown data type %d!\n", tag->type); } @@ -1149,16 +1149,16 @@ exif_write_value(exif_tag_t *tag, gbfile *fout) } static void -exif_write_ifd(const exif_ifd_t *ifd, const char next, gbfile *fout) +exif_write_ifd(const exif_ifd_t* ifd, const char next, gbfile* fout) { gbsize_t offs; - queue *elem, *tmp; + queue* elem, *tmp; gbfputuint16(ifd->count, fout); offs = gbftell(fout) + (ifd->count * 12) + 4; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t *tag = (exif_tag_t *)elem; + exif_tag_t* tag = (exif_tag_t*)elem; gbfputuint16(tag->id, fout); gbfputuint16(tag->type, fout); @@ -1182,11 +1182,11 @@ exif_write_ifd(const exif_ifd_t *ifd, const char next, gbfile *fout) } QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { - exif_tag_t *tag = (exif_tag_t *)elem; + exif_tag_t* tag = (exif_tag_t*)elem; if (tag->size > 4) { gbuint16 i; - char *ptr = tag->data; + char* ptr = (char*) tag->data; if BYTE_TYPE(tag->type) { gbfwrite(tag->data, tag->size, 1, fout); @@ -1194,23 +1194,23 @@ exif_write_ifd(const exif_ifd_t *ifd, const char next, gbfile *fout) switch (tag->type) { case EXIF_TYPE_SHORT: case EXIF_TYPE_SSHORT: - gbfputuint16(*(gbint16 *)ptr, fout); + gbfputuint16(*(gbint16*)ptr, fout); break; case EXIF_TYPE_LONG: case EXIF_TYPE_SLONG: case EXIF_TYPE_IFD: - gbfputuint32(*(gbint32 *)ptr, fout); + gbfputuint32(*(gbint32*)ptr, fout); break; case EXIF_TYPE_RAT: case EXIF_TYPE_SRAT: - gbfputuint32(*(gbint32 *)ptr, fout); - gbfputuint32(*(gbint32 *)(ptr+4), fout); + gbfputuint32(*(gbint32*)ptr, fout); + gbfputuint32(*(gbint32*)(ptr+4), fout); break; case EXIF_TYPE_FLOAT: - gbfputflt(*(float *)ptr, fout); + gbfputflt(*(float*)ptr, fout); break; case EXIF_TYPE_DOUBLE: - gbfputdbl(*(double *)ptr, fout); + gbfputdbl(*(double*)ptr, fout); break; default: gbfwrite(ptr, exif_type_size(tag->type), 1, fin); @@ -1228,20 +1228,20 @@ exif_write_ifd(const exif_ifd_t *ifd, const char next, gbfile *fout) static void exif_write_apps(void) { - queue *e0, *t0; + queue* e0, *t0; gbfputuint16(0xFFD8, fout); QUEUE_FOR_EACH(&exif_apps, e0, t0) { - exif_app_t *app = (exif_app_t *)e0; + exif_app_t* app = (exif_app_t*)e0; gbfputuint16(app->marker, fout); if (app == exif_app) { - queue *e1, *t1; + queue* e1, *t1; gbuint16 len = 8; - gbfile *ftmp; - exif_tag_t *tag; + gbfile* ftmp; + exif_tag_t* tag; exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, 0); exif_put_long(GPS_IFD, GPS_IFD_TAG_VERSION, 0, 2); @@ -1249,7 +1249,7 @@ exif_write_apps(void) sortqueue(&exif_app->ifds, exif_sort_ifds_cb); QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t *ifd = (exif_ifd_t *)e1; + exif_ifd_t* ifd = (exif_ifd_t*)e1; if (ifd->nr == GPS_IFD) { exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, len); @@ -1269,7 +1269,7 @@ exif_write_apps(void) } QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t *ifd = (exif_ifd_t *)e1; + exif_ifd_t* ifd = (exif_ifd_t*)e1; sortqueue(&ifd->tags, exif_sort_tags_cb); } @@ -1281,8 +1281,8 @@ exif_write_apps(void) gbfputuint32(0x08, ftmp); /* offset to first IFD */ QUEUE_FOR_EACH(&app->ifds, e1, t1) { - exif_ifd_t *ifd = (exif_ifd_t *)e1; - exif_ifd_t *ifd_next = (exif_ifd_t *)t1; + exif_ifd_t* ifd = (exif_ifd_t*)e1; + exif_ifd_t* ifd_next = (exif_ifd_t*)t1; char next; if ((ifd->nr == IFD0) && (ifd_next->nr == IFD1)) { @@ -1325,7 +1325,7 @@ exif_write_apps(void) *******************************************************************************/ static void -exif_rd_init(const char *fname) +exif_rd_init(const char* fname) { fin = gbfopen_be(fname, "rb", MYNAME); QUEUE_INIT(&exif_apps); @@ -1342,7 +1342,7 @@ static void exif_read(void) { gbuint16 soi; - waypoint *wpt; + waypoint* wpt; soi = gbfgetuint16(fin); is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); /* only jpeg for now */ @@ -1358,10 +1358,10 @@ exif_read(void) } static void -exif_wr_init(const char *fname) +exif_wr_init(const char* fname) { gbuint16 soi; - char *tmpname; + char* tmpname; exif_success = 0; exif_fout_name = xstrdup(fname); @@ -1391,7 +1391,7 @@ exif_wr_init(const char *fname) static void exif_wr_deinit(void) { - char *tmpname; + char* tmpname; exif_release_apps(); tmpname = xstrdup(fout->name); @@ -1430,7 +1430,7 @@ exif_write(void) warning(MYNAME ": No matching point with name \"%s\" found.\n", opt_name); } } else { - char *str = exif_time_str(exif_time_ref); + char* str = exif_time_str(exif_time_ref); track_disp_all(NULL, NULL, exif_find_wpt_by_time); route_disp_all(NULL, NULL, exif_find_wpt_by_time); @@ -1443,7 +1443,7 @@ exif_write(void) } else if (abs(exif_time_ref - exif_wpt_ref->creation_time) > frame) { warning(MYNAME ": No matching point found for image date %s!\n", str); if (exif_wpt_ref != NULL) { - char *str = exif_time_str(exif_wpt_ref->creation_time); + char* str = exif_time_str(exif_wpt_ref->creation_time); warning(MYNAME ": Best is from %s, %d second(s) away.\n", str, abs(exif_time_ref - exif_wpt_ref->creation_time)); xfree(str); @@ -1454,7 +1454,7 @@ exif_write(void) } if (exif_wpt_ref != NULL) { - const waypoint *wpt = exif_wpt_ref; + const waypoint* wpt = exif_wpt_ref; exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, 0); exif_put_long(GPS_IFD, GPS_IFD_TAG_VERSION, 0, 2); @@ -1534,7 +1534,7 @@ exif_write(void) ff_vecs_t exif_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, ff_cap_none /* routes */ }, diff --git a/gpsbabel/explorist_ini.c b/gpsbabel/explorist_ini.c index bc1c702c4..7c06b34d9 100644 --- a/gpsbabel/explorist_ini.c +++ b/gpsbabel/explorist_ini.c @@ -2,21 +2,21 @@ #include "inifile.h" #include "explorist_ini.h" -static inifile_t *inifile; +static inifile_t* inifile; static const char myname[] = "explorist"; -const char * -explorist_read_value(const char* section, const char *key) +const char* +explorist_read_value(const char* section, const char* key) { return inifile_readstr(inifile, section, key); } -static mag_info * -explorist_ini_try(const char *path) +static mag_info* +explorist_ini_try(const char* path) { - mag_info *info = NULL; - char *inipath; - char *s; + mag_info* info = NULL; + char* inipath; + char* s; xasprintf(&inipath, "%s/%s", path, "APP/Atlas.ini"); inifile = inifile_init(inipath, myname); @@ -25,7 +25,7 @@ explorist_ini_try(const char *path) return NULL; } - info = xmalloc(sizeof(mag_info)); + info = (mag_info*) xmalloc(sizeof(mag_info)); info->geo_path = NULL; info->track_path = NULL; info->waypoint_path = NULL; @@ -51,10 +51,10 @@ explorist_ini_try(const char *path) return info; } -mag_info * -explorist_ini_get(const char **dirlist) +mag_info* +explorist_ini_get(const char** dirlist) { - mag_info *r = NULL; + mag_info* r = NULL; while (dirlist && *dirlist) { r = explorist_ini_try(*dirlist); if (r) { @@ -65,7 +65,7 @@ explorist_ini_get(const char **dirlist) } void -explorist_ini_done(mag_info *info) +explorist_ini_done(mag_info* info) { xfree(info->geo_path); xfree(info->track_path); diff --git a/gpsbabel/explorist_ini.h b/gpsbabel/explorist_ini.h index 665b0de37..06ce09b2d 100644 --- a/gpsbabel/explorist_ini.h +++ b/gpsbabel/explorist_ini.h @@ -8,5 +8,5 @@ typedef struct { char* waypoint_path; } mag_info; -mag_info * explorist_ini_get(const char **directory_list); -void explorist_ini_done(mag_info *info); +mag_info* explorist_ini_get(const char** directory_list); +void explorist_ini_done(mag_info* info); diff --git a/gpsbabel/fatal.c b/gpsbabel/fatal.c index 52a11f095..9e5ccebd6 100644 --- a/gpsbabel/fatal.c +++ b/gpsbabel/fatal.c @@ -21,7 +21,7 @@ #include "defs.h" void -fatal(const char *fmt, ...) +fatal(const char* fmt, ...) { va_list ap; va_start(ap, fmt); @@ -31,7 +31,7 @@ fatal(const char *fmt, ...) } void -warning(const char *fmt, ...) +warning(const char* fmt, ...) { va_list ap; va_start(ap, fmt); diff --git a/gpsbabel/filter_skeleton.c b/gpsbabel/filter_skeleton.c index 3567b4888..c564852f2 100644 --- a/gpsbabel/filter_skeleton.c +++ b/gpsbabel/filter_skeleton.c @@ -48,7 +48,7 @@ arglist_t filter_skeleton_args[] = { *******************************************************************************/ static void -filter_skeleton_init(const char *args) +filter_skeleton_init(const char* args) { /* Called before filter processing */ diff --git a/gpsbabel/filter_vecs.c b/gpsbabel/filter_vecs.c index c4597c3a3..1c8bf9944 100644 --- a/gpsbabel/filter_vecs.c +++ b/gpsbabel/filter_vecs.c @@ -25,9 +25,9 @@ #include "gbversion.h" typedef struct { - filter_vecs_t *vec; - const char *name; - const char *desc; + filter_vecs_t* vec; + const char* name; + const char* desc; } fl_vecs_t; extern filter_vecs_t position_vecs; @@ -145,17 +145,17 @@ fl_vecs_t filter_vec_list[] = { } }; -filter_vecs_t * -find_filter_vec(char *const vecname, char **opts) +filter_vecs_t* +find_filter_vec(char* const vecname, char** opts) { - fl_vecs_t *vec = filter_vec_list; - char *v = xstrdup(vecname); - char *svecname = strtok(v, ","); + fl_vecs_t* vec = filter_vec_list; + char* v = xstrdup(vecname); + char* svecname = strtok(v, ","); int found = 0; while (vec->vec) { - arglist_t *ap; - char *res; + arglist_t* ap; + char* res; if (case_ignore_strcmp(svecname, vec->name)) { vec++; @@ -165,7 +165,7 @@ find_filter_vec(char *const vecname, char **opts) /* step 1: initialize by inifile or default values */ if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { - const char *temp; + const char* temp; temp = inifile_readstr(global_opts.inifile, vec->name, ap->argstring); if (temp == NULL) { @@ -185,7 +185,7 @@ find_filter_vec(char *const vecname, char **opts) if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { - char *opt; + char* opt; opt = get_option(*opts, ap->argstring); if (opt) { @@ -213,9 +213,9 @@ find_filter_vec(char *const vecname, char **opts) } void -free_filter_vec(filter_vecs_t *fvec) +free_filter_vec(filter_vecs_t* fvec) { - arglist_t *ap; + arglist_t* ap; if (fvec->args) { for (ap = fvec->args; ap->argstring; ap++) { @@ -230,9 +230,9 @@ free_filter_vec(filter_vecs_t *fvec) void init_filter_vecs(void) { - fl_vecs_t *vec = filter_vec_list; + fl_vecs_t* vec = filter_vec_list; while (vec->vec) { - arglist_t *ap; + arglist_t* ap; if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { ap->argvalptr = NULL; @@ -245,7 +245,7 @@ init_filter_vecs(void) void exit_filter_vecs(void) { - fl_vecs_t *vec = filter_vec_list; + fl_vecs_t* vec = filter_vec_list; while (vec->vec) { if (vec->vec->f_exit) { (vec->vec->f_exit)(); @@ -261,8 +261,8 @@ exit_filter_vecs(void) void disp_filter_vecs(void) { - fl_vecs_t *vec; - arglist_t *ap; + fl_vecs_t* vec; + arglist_t* ap; for (vec = filter_vec_list; vec->vec; vec++) { printf(" %-20.20s %-50.50s\n", @@ -277,10 +277,10 @@ disp_filter_vecs(void) } void -disp_filter_vec(const char *vecname) +disp_filter_vec(const char* vecname) { - fl_vecs_t *vec; - arglist_t *ap; + fl_vecs_t* vec; + arglist_t* ap; for (vec = filter_vec_list; vec->vec; vec++) { if (case_ignore_strcmp(vec->name, vecname)) { @@ -298,16 +298,16 @@ disp_filter_vec(const char *vecname) } static signed int -alpha(const void *a, const void *b) +alpha(const void* a, const void* b) { - const fl_vecs_t *const ap = (const fl_vecs_t*) a; - const fl_vecs_t *const bp = (const fl_vecs_t*) b; + const fl_vecs_t* const ap = (const fl_vecs_t*) a; + const fl_vecs_t* const bp = (const fl_vecs_t*) b; return case_ignore_strcmp(ap->desc , bp->desc); } static -void disp_help_url(const fl_vecs_t *vec, arglist_t *arg) +void disp_help_url(const fl_vecs_t* vec, arglist_t* arg) { printf("\t" WEB_DOC_DIR "/fmt_%s.html", vec->name); if (arg) { @@ -316,9 +316,9 @@ void disp_help_url(const fl_vecs_t *vec, arglist_t *arg) } static void -disp_v1(const fl_vecs_t *vec) +disp_v1(const fl_vecs_t* vec) { - arglist_t *ap; + arglist_t* ap; disp_help_url(vec, NULL); printf("\n"); @@ -346,7 +346,7 @@ disp_v1(const fl_vecs_t *vec) void disp_filters(int version) { - fl_vecs_t *vec; + fl_vecs_t* vec; qsort(filter_vec_list, sizeof(filter_vec_list) / sizeof(filter_vec_list[0]) - 1, diff --git a/gpsbabel/filterdefs.h b/gpsbabel/filterdefs.h index e5993222c..6af9a747f 100644 --- a/gpsbabel/filterdefs.h +++ b/gpsbabel/filterdefs.h @@ -33,14 +33,14 @@ typedef struct filter_vecs { filter_process f_process; filter_deinit f_deinit; filter_exit f_exit; - arglist_t *args; + arglist_t* args; } filter_vecs_t; -filter_vecs_t * find_filter_vec(char * const, char **); -void free_filter_vec(filter_vecs_t *); +filter_vecs_t* find_filter_vec(char* const, char**); +void free_filter_vec(filter_vecs_t*); void disp_filters(int version); -void disp_filter(const char *vecname); -void disp_filter_vec(const char *vecname); +void disp_filter(const char* vecname); +void disp_filter_vec(const char* vecname); void disp_filter_vecs(void); void init_filter_vecs(void); void exit_filter_vecs(void); diff --git a/gpsbabel/format_skeleton.c b/gpsbabel/format_skeleton.c index ffcaec373..695149eb8 100644 --- a/gpsbabel/format_skeleton.c +++ b/gpsbabel/format_skeleton.c @@ -58,7 +58,7 @@ arglist_t format_skeleton_args[] = { *******************************************************************************/ static void -format_skeleton_rd_init(const char *fname) +format_skeleton_rd_init(const char* fname) { // fin = gbfopen(fname, "r", MYNAME); } @@ -105,7 +105,7 @@ format_skeleton_read(void) } static void -format_skeleton_wr_init(const char *fname) +format_skeleton_wr_init(const char* fname) { // fout = gbfopen(fname, "w", MYNAME); } diff --git a/gpsbabel/formspec.c b/gpsbabel/formspec.c index 6e73fe6bb..517143359 100644 --- a/gpsbabel/formspec.c +++ b/gpsbabel/formspec.c @@ -25,13 +25,13 @@ #include "defs.h" -format_specific_data *fs_chain_copy(format_specific_data *source) +format_specific_data* fs_chain_copy(format_specific_data* source) { - format_specific_data *result = NULL; + format_specific_data* result = NULL; - format_specific_data **copy = &result; + format_specific_data** copy = &result; while (source) { - source->copy((void **)copy, (void *)source); + source->copy((void**)copy, (void*)source); /* prevent segfaults from badly-behaved copy functions */ (*copy)->next = NULL; copy = &((*copy)->next); @@ -40,10 +40,10 @@ format_specific_data *fs_chain_copy(format_specific_data *source) return result; } -void fs_chain_destroy(format_specific_data *chain) +void fs_chain_destroy(format_specific_data* chain) { - format_specific_data *cur = chain; - format_specific_data *next = NULL; + format_specific_data* cur = chain; + format_specific_data* next = NULL; while (cur) { next = cur->next; cur->destroy(cur); @@ -51,9 +51,9 @@ void fs_chain_destroy(format_specific_data *chain) } } -format_specific_data *fs_chain_find(format_specific_data *chain, long type) +format_specific_data* fs_chain_find(format_specific_data* chain, long type) { - format_specific_data *cur = chain; + format_specific_data* cur = chain; while (cur) { if (cur->type == type) { return cur; @@ -63,7 +63,7 @@ format_specific_data *fs_chain_find(format_specific_data *chain, long type) return NULL; } -void fs_chain_add(format_specific_data **chain, format_specific_data *data) +void fs_chain_add(format_specific_data** chain, format_specific_data* data) { data->next = *chain; *chain = data; diff --git a/gpsbabel/g7towin.c b/gpsbabel/g7towin.c index 3e6ba7016..6a31212a5 100644 --- a/gpsbabel/g7towin.c +++ b/gpsbabel/g7towin.c @@ -39,7 +39,7 @@ #define G7T_HEADER "Version 2:G7T" -static gbfile *fin; +static gbfile* fin; static grid_type grid; static int datum; static gpsdata_type mode; @@ -70,9 +70,9 @@ arglist_t g7towin_args[] = { #define WPT_cD_OFS 0x0cD00 static void -parse_line(char *buff, int index, const char *delimiter, waypoint *wpt) +parse_line(char* buff, int index, const char* delimiter, waypoint* wpt) { - char *cin; + char* cin; garmin_fs_p gmsd = GMSD_FIND(wpt); while ((cin = csv_lineparse(buff, delimiter, "", index++))) { @@ -91,7 +91,7 @@ parse_line(char *buff, int index, const char *delimiter, waypoint *wpt) int categories, dyn; struct tm tm; - char *cerr; + char* cerr; case TRKPT__OFS + 1: cin += parse_coordinates(cin, datum, grid, @@ -268,18 +268,18 @@ parse_line(char *buff, int index, const char *delimiter, waypoint *wpt) } } -static waypoint * -parse_waypt(char *buff) +static waypoint* +parse_waypt(char* buff) { - char *cin, *cerr; + char* cin, *cerr; int i; struct tm tm; - waypoint *wpt; + waypoint* wpt; garmin_fs_p gmsd; wpt = waypt_new(); gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); if (gardown) { cin = buff + 6; @@ -343,15 +343,15 @@ parse_waypt(char *buff) return wpt; } -static waypoint * -parse_trkpt(char *buff) +static waypoint* +parse_trkpt(char* buff) { garmin_fs_p gmsd; - waypoint *wpt; + waypoint* wpt; wpt = waypt_new(); gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); parse_line(buff, TRKPT__OFS, ";", wpt); @@ -365,9 +365,9 @@ parse_trkpt(char *buff) */ static void -parse_categories(char *buff) +parse_categories(char* buff) { - char *cin; + char* cin; int cat = 0; while ((cin = csv_lineparse(buff, ",", "", cat++))) { @@ -388,7 +388,7 @@ parse_categories(char *buff) /* main functions */ static void -rd_init(const char *fname) +rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); @@ -409,15 +409,15 @@ rd_deinit(void) static void data_read(void) { - char *buff; + char* buff; int line = 0; - waypoint *wpt = NULL; - waypoint *prev = NULL; - route_head *head = NULL; + waypoint* wpt = NULL; + waypoint* prev = NULL; + route_head* head = NULL; while ((buff = gbfgetstr(fin))) { - char *cin = buff; - char *cdata; + char* cin = buff; + char* cdata; if ((line++ == 0) && fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -540,7 +540,7 @@ data_read(void) cdata++; } if (*cdata) { - char *s; + char* s; s = strrchr(cdata, ','); if (s) { *s = '\0'; diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index 72175aa2f..6b5a4f5dc 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -31,32 +31,32 @@ #define SOON 1 #define MYNAME "GARMIN" -static const char *portname; +static const char* portname; static short_handle mkshort_handle; -static GPS_PWay *tx_waylist; -static GPS_PWay *tx_routelist; -static GPS_PWay *cur_tx_routelist_entry; -static GPS_PTrack *tx_tracklist; -static GPS_PTrack *cur_tx_tracklist_entry; +static GPS_PWay* tx_waylist; +static GPS_PWay* tx_routelist; +static GPS_PWay* cur_tx_routelist_entry; +static GPS_PTrack* tx_tracklist; +static GPS_PTrack* cur_tx_tracklist_entry; static int my_track_count = 0; -static char *getposn = NULL; -static char *poweroff = NULL; -static char *eraset = NULL; -static char *resettime = NULL; -static char *snlen = NULL; -static char *snwhiteopt = NULL; -static char *deficon = NULL; -static char *category = NULL; -static char *categorybitsopt = NULL; +static char* getposn = NULL; +static char* poweroff = NULL; +static char* eraset = NULL; +static char* resettime = NULL; +static char* snlen = NULL; +static char* snwhiteopt = NULL; +static char* deficon = NULL; +static char* category = NULL; +static char* categorybitsopt = NULL; static int categorybits; static int receiver_must_upper = 1; -static ff_vecs_t *gpx_vec; +static ff_vecs_t* gpx_vec; #define MILITANT_VALID_WAYPT_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" /* Technically, even this is a little loose as spaces arent allowed */ -static const char *valid_waypt_chars = MILITANT_VALID_WAYPT_CHARS " "; +static const char* valid_waypt_chars = MILITANT_VALID_WAYPT_CHARS " "; static arglist_t garmin_args[] = { @@ -96,16 +96,16 @@ arglist_t garmin_args[] = { ARG_TERMINATOR }; -static const char * d103_symbol_from_icon_number(unsigned int n); -static int d103_icon_number_from_symbol(const char *s); +static const char* d103_symbol_from_icon_number(unsigned int n); +static int d103_icon_number_from_symbol(const char* s); static void -rw_init(const char *fname) +rw_init(const char* fname) { int receiver_short_length; int receiver_must_upper = 1; - const char * receiver_charset = NULL; + const char* receiver_charset = NULL; if (!mkshort_handle) { mkshort_handle = mkshort_new_handle(); @@ -298,11 +298,11 @@ rw_init(const char *fname) } static void -rd_init(const char *fname) +rd_init(const char* fname) { if (setjmp(gdx_jmp_buf)) { - char *vec_opts = NULL; - const gdx_info *gi = gdx_get_info(); + char* vec_opts = NULL; + const gdx_info* gi = gdx_get_info(); gpx_vec = find_vec("gpx", &vec_opts); gpx_vec->rd_init(gi->from_device.canon); } else { @@ -320,7 +320,7 @@ rw_deinit(void) } static int -waypt_read_cb(int total_ct, GPS_PWay *way) +waypt_read_cb(int total_ct, GPS_PWay* way) { static int i; @@ -335,10 +335,10 @@ static void waypt_read(void) { int i,n; - GPS_PWay *way = NULL; + GPS_PWay* way = NULL; if (getposn) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); wpt->latitude = gps_save_lat; wpt->longitude = gps_save_lon; wpt->shortname = xstrdup("Position"); @@ -354,7 +354,7 @@ waypt_read(void) } for (i = 0; i < n; i++) { - waypoint *wpt_tmp = waypt_new(); + waypoint* wpt_tmp = waypt_new(); wpt_tmp->shortname = xstrdup(way[i]->ident); wpt_tmp->description = xstrdup(way[i]->cmnt); @@ -409,7 +409,7 @@ static int lap_read_nop_cb(int n, struct GPS_SWay** dp) // returns 1 if the waypoint's start_time can be found // in the laps array, 0 otherwise -unsigned int checkWayPointIsAtSplit(waypoint *wpt, GPS_PLap *laps, int nlaps) +unsigned int checkWayPointIsAtSplit(waypoint* wpt, GPS_PLap* laps, int nlaps) { int result = 0; @@ -441,11 +441,11 @@ void track_read(void) { int32 ntracks; - GPS_PTrack *array; - route_head *trk_head = NULL; + GPS_PTrack* array; + route_head* trk_head = NULL; int trk_num = 0; int i; - char *trk_name = ""; + char* trk_name = ""; GPS_PLap* laps = NULL; int nlaps = 0; int next_is_new_trkseg = 0; @@ -462,7 +462,7 @@ track_read(void) } for (i = 0; i < ntracks; i++) { - waypoint *wpt; + waypoint* wpt; /* * This is probably always in slot zero, but the Garmin @@ -530,12 +530,12 @@ route_read(void) { int32 nroutepts; int i; - GPS_PWay *array; + GPS_PWay* array; /* TODO: Fixes warning but is it right? * RJL: No, the warning isn't right; GCC's flow analysis is broken. * still, it's good taste... */ - route_head *rte_head = NULL; + route_head* rte_head = NULL; nroutepts = GPS_Command_Get_Route(portname, &array); @@ -543,7 +543,7 @@ route_read(void) #if 1 for (i = 0; i < nroutepts; i++) { if (array[i]->isrte) { - char *csrc = NULL; + char* csrc = NULL; /* What a horrible API has libjeeps for making this * my problem. */ @@ -566,7 +566,7 @@ route_read(void) if (array[i]->islink) { continue; } else { - waypoint *wpt_tmp = waypt_new(); + waypoint* wpt_tmp = waypt_new(); wpt_tmp->latitude = array[i]->lat; wpt_tmp->longitude = array[i]->lon; wpt_tmp->shortname = array[i]->ident; @@ -586,8 +586,8 @@ void lap_read_as_track(void) { int32 ntracks; - GPS_PLap *array; - route_head *trk_head = NULL; + GPS_PLap* array; + route_head* trk_head = NULL; int trk_num = 0; int index; int i; @@ -597,7 +597,7 @@ lap_read_as_track(void) return; } for (i = 0; i < ntracks; i++) { - waypoint *wpt; + waypoint* wpt; if (array[i]->index == -1) { index=i; } else { @@ -611,7 +611,7 @@ lap_read_as_track(void) /* D10xx - no real separator, use begin/end time to guess */ (abs(array[i-1]->start_time + array[i]->total_time/100-array[i]->start_time) > 2) ) { - static struct tm * stmp; + static struct tm* stmp; stmp = gmtime(&array[i]->start_time); trk_head = route_head_alloc(); /*For D906, we would like to use the track_index in the last packet instead...*/ @@ -677,7 +677,7 @@ lap_read_as_track(void) * to the data type we use throughout. Yes, we do lose some data that way. */ static void -pvt2wpt(GPS_PPvt_Data pvt, waypoint *wpt) +pvt2wpt(GPS_PPvt_Data pvt, waypoint* wpt) { double wptime, wptimes; @@ -741,19 +741,19 @@ pvt2wpt(GPS_PPvt_Data pvt, waypoint *wpt) } } -static gpsdevh *pvt_fd; +static gpsdevh* pvt_fd; static void -pvt_init(const char *fname) +pvt_init(const char* fname) { rw_init(fname); GPS_Command_Pvt_On(fname, &pvt_fd); } -static waypoint * -pvt_read(posn_status *posn_status) +static waypoint* +pvt_read(posn_status* posn_status) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); GPS_PPvt_Data pvt = GPS_Pvt_New(); if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) { @@ -839,7 +839,7 @@ sane_GPS_Way_New(void) } static int -waypt_write_cb(GPS_PWay *way) +waypt_write_cb(GPS_PWay* way) { static int i; int n = waypt_count(); @@ -855,8 +855,8 @@ waypt_write_cb(GPS_PWay *way) * If we're using smart names, try to put the cache info in the * description. */ -const char * -get_gc_info(waypoint *wpt) +const char* +get_gc_info(waypoint* wpt) { if (global_opts.smart_names) { if (wpt->gc_data->type == gt_virtual) { @@ -889,7 +889,7 @@ waypoint_prepare(void) { int i; int n = waypt_count(); - queue *elem, *tmp; + queue* elem, *tmp; extern queue waypt_head; int icon; @@ -902,12 +902,12 @@ waypoint_prepare(void) i = 0; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - waypoint *wpt; - char *ident; - char *src = NULL; + waypoint* wpt; + char* ident; + char* src = NULL; char obuf[256]; - wpt = (waypoint *) elem; + wpt = (waypoint*) elem; if (wpt->description) { src = wpt->description; @@ -1025,7 +1025,7 @@ waypoint_write(void) } static void -route_hdr_pr(const route_head *rte) +route_hdr_pr(const route_head* rte) { (*cur_tx_routelist_entry)->rte_num = rte->rte_num; (*cur_tx_routelist_entry)->isrte = 1; @@ -1036,10 +1036,10 @@ route_hdr_pr(const route_head *rte) } static void -route_waypt_pr(const waypoint *wpt) +route_waypt_pr(const waypoint* wpt) { GPS_PWay rte = *cur_tx_routelist_entry; - char *s, *d; + char* s, *d; /* * As stupid as this is, libjeeps seems to want an empty @@ -1094,7 +1094,7 @@ route_waypt_pr(const waypoint *wpt) } static void -route_noop(const route_head *wp) +route_noop(const route_head* wp) { } @@ -1116,7 +1116,7 @@ route_write(void) } static void -track_hdr_pr(const route_head *trk_head) +track_hdr_pr(const route_head* trk_head) { (*cur_tx_tracklist_entry)->ishdr = gpsTrue; if (trk_head->rte_name) { @@ -1130,7 +1130,7 @@ track_hdr_pr(const route_head *trk_head) } static void -track_waypt_pr(const waypoint *wpt) +track_waypt_pr(const waypoint* wpt) { (*cur_tx_tracklist_entry)->lat = wpt->latitude; (*cur_tx_tracklist_entry)->lon = wpt->longitude; @@ -1243,7 +1243,7 @@ ff_vecs_t garmin_vecs = { { pvt_init, pvt_read, rw_deinit, NULL, NULL, NULL } }; -static const char *d103_icons[16] = { +static const char* d103_icons[16] = { "dot", "house", "gas", @@ -1262,7 +1262,7 @@ static const char *d103_icons[16] = { "back-track" }; -static const char * +static const char* d103_symbol_from_icon_number(unsigned int n) { if (n <= 15) { @@ -1273,7 +1273,7 @@ d103_symbol_from_icon_number(unsigned int n) } static int -d103_icon_number_from_symbol(const char *s) +d103_icon_number_from_symbol(const char* s) { unsigned int i; diff --git a/gpsbabel/garmin_device_xml.c b/gpsbabel/garmin_device_xml.c index f2cb8c880..8630ada61 100644 --- a/gpsbabel/garmin_device_xml.c +++ b/gpsbabel/garmin_device_xml.c @@ -30,17 +30,18 @@ #define MYNAME "whatever" -static gdx_info *my_gdx_info; +static gdx_info* my_gdx_info; static int type; -static char *mountpoint, *base, *path, *ext; +static char* mountpoint, *base, *path, *ext; static xg_callback device_s, id_s, path_s, ext_s, base_s, dir_s; +jmp_buf gdx_jmp_buf; -void type_s(const char *args, const char **unused) +void type_s(const char* args, const char** unused) { type = strcmp(args, "GPSData"); } -void device_s(const char *args, const char **unused) +void device_s(const char* args, const char** unused) { if (my_gdx_info) { fatal(MYNAME ": More than one device type found in file.\n"); @@ -49,27 +50,27 @@ void device_s(const char *args, const char **unused) my_gdx_info->device_desc = xstrdup(args); } -void id_s(const char *args, const char **unused) +void id_s(const char* args, const char** unused) { my_gdx_info->device_id = xstrdup(args); } -void path_s(const char *args, const char **unused) +void path_s(const char* args, const char** unused) { path = xstrdup(args); } -void ext_s(const char *args, const char **unused) +void ext_s(const char* args, const char** unused) { ext = xstrdup(args); } -void base_s(const char *args, const char **unused) +void base_s(const char* args, const char** unused) { base = xstrdup(args); } -void dir_s(const char *args, const char **unused) +void dir_s(const char* args, const char** unused) { if (type) { return; @@ -119,11 +120,11 @@ static xg_tag_mapping gdx_map[] = { { 0, (xg_cb_type) 0, NULL } }; -const gdx_info * -gdx_read(const char *fname) +const gdx_info* +gdx_read(const char* fname) { // Test file open-able before gb_open gets a chance to fatal(). - FILE *fin = fopen(fname, "r"); + FILE* fin = fopen(fname, "r"); if (fin) { fclose(fin); @@ -137,12 +138,12 @@ gdx_read(const char *fname) // Look for the Device in the incoming NULL-terminated list of directories -const gdx_info * -gdx_find_file(char **dirlist) +const gdx_info* +gdx_find_file(char** dirlist) { - const gdx_info *gdx; + const gdx_info* gdx; while (dirlist && *dirlist) { - char *tbuf; + char* tbuf; xasprintf(&tbuf, "%s/%s", *dirlist, "/Garmin/GarminDevice.xml"); mountpoint = *dirlist; gdx = gdx_read(tbuf); @@ -155,7 +156,7 @@ gdx_find_file(char **dirlist) return NULL; } -const gdx_info * +const gdx_info* gdx_get_info() { return my_gdx_info; diff --git a/gpsbabel/garmin_device_xml.h b/gpsbabel/garmin_device_xml.h index cc8474152..1edd98ded 100644 --- a/gpsbabel/garmin_device_xml.h +++ b/gpsbabel/garmin_device_xml.h @@ -24,27 +24,27 @@ * Describes a file on the unit. */ typedef struct { - char *path; - char *basename; - char *extension; - char *canon; // full name, when applicable. + char* path; + char* basename; + char* extension; + char* canon; // full name, when applicable. } gdx_file; /* * The interesting traits of this device. */ typedef struct { - const char *device_desc; - const char *device_id; - const char *device_mounted_path; // Not from the file; about the file. + const char* device_desc; + const char* device_id; + const char* device_mounted_path; // Not from the file; about the file. gdx_file from_device; gdx_file to_device; // gdx_file geocache_logs; } gdx_info; -const gdx_info* gdx_read(const char *fname); -const gdx_info * gdx_get_info(void); -const gdx_info * gdx_find_file(char **dirlist); +const gdx_info* gdx_read(const char* fname); +const gdx_info* gdx_get_info(void); +const gdx_info* gdx_find_file(char** dirlist); // This is so gross. By the time we know it's not a USB device // and could be one of our devices, we're so deep into the callstack @@ -52,7 +52,7 @@ const gdx_info * gdx_find_file(char **dirlist); // (Mac|Lin|Win) x (USB|Serial) matrix. Since we don't *really* want // to progress any further, we just longjump back to the caller... #include -jmp_buf gdx_jmp_buf; +extern jmp_buf gdx_jmp_buf; #if 0 @@ -69,13 +69,13 @@ struct gpx_global { gpx_global_entry urlname; gpx_global_entry keywords; /* time and bounds aren't here; they're recomputed. */ -} *gpx_global ; +}* gpx_global ; static void -gpx_add_to_global(gpx_global_entry *ge, char *cdata) +gpx_add_to_global(gpx_global_entry* ge, char* cdata) { - queue *elem, *tmp; - gpx_global_entry * gep; + queue* elem, *tmp; + gpx_global_entry* gep; QUEUE_FOR_EACH(&ge->queue, elem, tmp) { gep = BASE_STRUCT(elem, gpx_global_entry, queue); @@ -91,22 +91,22 @@ gpx_add_to_global(gpx_global_entry *ge, char *cdata) } static void -gpx_rm_from_global(gpx_global_entry *ge) +gpx_rm_from_global(gpx_global_entry* ge) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ge->queue, elem, tmp) { - gpx_global_entry *g = (gpx_global_entry *) dequeue(elem); + gpx_global_entry* g = (gpx_global_entry*) dequeue(elem); xfree(g->tagdata); xfree(g); } } static void -gpx_write_gdata(gpx_global_entry *ge, char *tag) +gpx_write_gdata(gpx_global_entry* ge, char* tag) { - queue *elem, *tmp; - gpx_global_entry * gep; + queue* elem, *tmp; + gpx_global_entry* gep; if (!gpx_global || QUEUE_EMPTY(&ge->queue)) { return; @@ -130,7 +130,7 @@ gpx_write_gdata(gpx_global_entry *ge, char *tag) typedef struct tag_mapping { tag_type tag_type; /* enum from above for this tag */ int tag_passthrough; /* true if we don't generate this */ - const char *tag_name; /* xpath-ish tag name */ + const char* tag_name; /* xpath-ish tag name */ unsigned long crc; /* Crc32 of tag_name */ } tag_mapping; @@ -258,9 +258,9 @@ tag_mapping tag_path_map[] = { }; static tag_type -get_tag(const char *t, int *passthrough) +get_tag(const char* t, int* passthrough) { - tag_mapping *tm; + tag_mapping* tm; unsigned long tcrc = get_crc32_s(t); for (tm = tag_path_map; tm->tag_type != 0; tm++) { @@ -276,16 +276,16 @@ get_tag(const char *t, int *passthrough) static void prescan_tags(void) { - tag_mapping *tm; + tag_mapping* tm; for (tm = tag_path_map; tm->tag_type != 0; tm++) { tm->crc = get_crc32_s(tm->tag_name); } } static void -tag_gpx(const char **attrv) +tag_gpx(const char** attrv) { - const char **avp; + const char** avp; for (avp = &attrv[0]; *avp; avp += 2) { if (strcmp(avp[0], "version") == 0) { gpx_version = avp[1]; @@ -315,9 +315,9 @@ tag_gpx(const char **attrv) } static void -tag_wpt(const char **attrv) +tag_wpt(const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; wpt_tmp = waypt_new(); @@ -336,9 +336,9 @@ tag_wpt(const char **attrv) } static void -tag_cache_desc(const char ** attrv) +tag_cache_desc(const char** attrv) { - const char **avp; + const char** avp; cache_descr_is_html = 0; for (avp = &attrv[0]; *avp; avp+=2) { @@ -351,9 +351,9 @@ tag_cache_desc(const char ** attrv) } static void -tag_gs_cache(const char **attrv) +tag_gs_cache(const char** attrv) { - const char **avp; + const char** avp; for (avp = &attrv[0]; *avp; avp+=2) { if (strcmp(avp[0], "id") == 0) { @@ -375,19 +375,19 @@ tag_gs_cache(const char **attrv) } static void -start_something_else(const char *el, const char **attrv) +start_something_else(const char* el, const char** attrv) { - const char **avp = attrv; - char **avcp = NULL; + const char** avp = attrv; + char** avcp = NULL; int attr_count = 0; - xml_tag *new_tag; - fs_xml *fs_gpx; + xml_tag* new_tag; + fs_xml* fs_gpx; if (!fs_ptr) { return; } - new_tag = (xml_tag *)xcalloc(sizeof(xml_tag),1); + new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1); new_tag->tagname = xstrdup(el); /* count attributes */ @@ -398,7 +398,7 @@ start_something_else(const char *el, const char **attrv) /* copy attributes */ avp = attrv; - new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count+1); + new_tag->attributes = (char**)xcalloc(sizeof(char*),attr_count+1); avcp = new_tag->attributes; while (*avp) { *avcp = xstrdup(*avp); @@ -420,7 +420,7 @@ start_something_else(const char *el, const char **attrv) new_tag->parent = cur_tag; } } else { - fs_gpx = (fs_xml *)fs_chain_find(*fs_ptr, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX); if (fs_gpx && fs_gpx->tag) { cur_tag = fs_gpx->tag; @@ -432,7 +432,7 @@ start_something_else(const char *el, const char **attrv) } else { fs_gpx = fs_xml_alloc(FS_GPX); fs_gpx->tag = new_tag; - fs_chain_add(fs_ptr, (format_specific_data *)fs_gpx); + fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx); new_tag->parent = NULL; } } @@ -448,10 +448,10 @@ end_something_else() } static void -tag_log_wpt(const char **attrv) +tag_log_wpt(const char** attrv) { - waypoint * lwp_tmp; - const char **avp = &attrv[0]; + waypoint* lwp_tmp; + const char** avp = &attrv[0]; /* create a new waypoint */ lwp_tmp = waypt_new(); @@ -485,13 +485,13 @@ tag_log_wpt(const char **attrv) } static void -gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) +gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) { - char *e; - char *ep; + char* e; + char* ep; int passthrough; - const char *el = xml_convert_to_char_string(xml_el); - const char **attr = xml_convert_attrs_to_char_string(xml_attr); + const char* el = xml_convert_to_char_string(xml_el); + const char** attr = xml_convert_attrs_to_char_string(xml_attr); vmem_realloc(¤t_tag, strlen(current_tag.mem) + 2 + strlen(el)); e = current_tag.mem; @@ -569,7 +569,7 @@ gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) struct gs_type_mapping { geocache_type type; - const char *name; + const char* name; } gs_type_map[] = { { gt_traditional, "Traditional Cache" }, { gt_traditional, "Traditional" }, /* opencaching.de */ @@ -596,7 +596,7 @@ struct struct gs_container_mapping { geocache_container type; - const char *name; + const char* name; } gs_container_map[] = { { gc_other, "Unknown" }, { gc_other, "Other" }, /* Synonym on read. */ @@ -608,7 +608,7 @@ struct }; geocache_type -gs_mktype(const char *t) +gs_mktype(const char* t) { int i; int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]); @@ -621,7 +621,7 @@ gs_mktype(const char *t) return gt_unknown; } -const char * +const char* gs_get_cachetype(geocache_type t) { int i; @@ -636,7 +636,7 @@ gs_get_cachetype(geocache_type t) } geocache_container -gs_mkcont(const char *t) +gs_mkcont(const char* t) { int i; int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]); @@ -649,7 +649,7 @@ gs_mkcont(const char *t) return gc_unknown; } -const char * +const char* gs_get_container(geocache_container t) { int i; @@ -664,16 +664,16 @@ gs_get_container(geocache_container t) } time_t -xml_parse_time(const char *cdatastr, int *microsecs) +xml_parse_time(const char* cdatastr, int* microsecs) { int off_hr = 0; int off_min = 0; int off_sign = 1; - char *offsetstr = NULL; - char *pointstr = NULL; + char* offsetstr = NULL; + char* pointstr = NULL; struct tm tm; time_t rv = 0; - char *timestr = xstrdup(cdatastr); + char* timestr = xstrdup(cdatastr); memset(&tm, 0, sizeof(tm)); @@ -732,12 +732,12 @@ xml_parse_time(const char *cdatastr, int *microsecs) } static void -gpx_end(void *data, const XML_Char *xml_el) +gpx_end(void* data, const XML_Char* xml_el) { - const char *el = xml_convert_to_char_string(xml_el); - char *s = strrchr(current_tag.mem, '/'); + const char* el = xml_convert_to_char_string(xml_el); + char* s = strrchr(current_tag.mem, '/'); float x; - char *cdatastrp = cdatastr.mem; + char* cdatastrp = cdatastr.mem; int passthrough; static time_t gc_log_date; tag_type tag; @@ -981,7 +981,7 @@ gpx_end(void *data, const XML_Char *xml_el) //TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link: //TODO: implement GPX 1.1 case tt_rte_rtept_link: { - char *lt = link_text; + char* lt = link_text; if (lt) { lt = xstrdup(lrtrim(link_text)); } @@ -1008,7 +1008,7 @@ gpx_end(void *data, const XML_Char *xml_el) #if ! HAVE_LIBEXPAT static void -gpx_rd_init(const char *fname) +gpx_rd_init(const char* fname) { fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n"); } @@ -1021,17 +1021,17 @@ gpx_rd_deinit(void) #else /* NO_EXPAT */ static void -gpx_cdata(void *dta, const XML_Char *xml_el, int len) +gpx_cdata(void* dta, const XML_Char* xml_el, int len) { - char *estr; - int *cdatalen; - char **cdata; - xml_tag *tmp_tag; + char* estr; + int* cdatalen; + char** cdata; + xml_tag* tmp_tag; size_t slen = strlen(cdatastr.mem); - const char *s = xml_convert_to_char_string_n(xml_el, &len); + const char* s = xml_convert_to_char_string_n(xml_el, &len); vmem_realloc(&cdatastr, 1 + len + slen); - estr = ((char *) cdatastr.mem) + slen; + estr = ((char*) cdatastr.mem) + slen; memcpy(estr, s, len); estr[len] = 0; @@ -1065,7 +1065,7 @@ gpx_cdata(void *dta, const XML_Char *xml_el, int len) } static void -gpx_rd_init(const char *fname) +gpx_rd_init(const char* fname) { if (fname[0]) { fd = gbfopen(fname, "r", MYNAME); @@ -1080,7 +1080,7 @@ gpx_rd_init(const char *fname) file_time = 0; current_tag = vmem_alloc(1, 0); - *((char *)current_tag.mem) = '\0'; + *((char*)current_tag.mem) = '\0'; prescan_tags(); @@ -1091,7 +1091,7 @@ gpx_rd_init(const char *fname) XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); cdatastr = vmem_alloc(1, 0); - *((char *)cdatastr.mem) = '\0'; + *((char*)cdatastr.mem) = '\0'; if (!xsi_schema_loc) { xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC); @@ -1156,7 +1156,7 @@ gpx_rd_deinit(void) #endif static void -gpx_wr_init(const char *fname) +gpx_wr_init(const char* fname) { mkshort_handle = mkshort_new_handle(); @@ -1176,7 +1176,7 @@ gpx_read(void) #if HAVE_LIBEXPAT int len; int done = 0; - char *buf = xmalloc(MY_CBUF_SZ); + char* buf = xmalloc(MY_CBUF_SZ); int result = 0; int extra; @@ -1195,8 +1195,8 @@ gpx_read(void) * we find it, strip it, then read byte-at-a-time * until we find a non-entity. */ - char *badchar; - char *semi; + char* badchar; + char* semi; int maxentlength = 8; len = gbfread(buf, 1, MY_CBUF_SZ - maxentlength, fd); done = gbfeof(fd) || !len; @@ -1220,11 +1220,11 @@ gpx_read(void) badchar = strchr(badchar+1, '&'); } { - char *hex="0123456789abcdef"; + char* hex="0123456789abcdef"; badchar = strstr(buf, "&#x"); while (badchar) { int val = 0; - char *hexit = badchar+3; + char* hexit = badchar+3; semi = strchr(badchar, ';'); if (semi) { while (*hexit && *hexit != ';') { @@ -1266,9 +1266,9 @@ gpx_read(void) } static void -fprint_tag_and_attrs(char *prefix, char *suffix, xml_tag *tag) +fprint_tag_and_attrs(char* prefix, char* suffix, xml_tag* tag) { - char **pa; + char** pa; gbfprintf(ofd, "%s%s", prefix, tag->tagname); pa = tag->attributes; if (pa) { @@ -1281,9 +1281,9 @@ fprint_tag_and_attrs(char *prefix, char *suffix, xml_tag *tag) } static void -fprint_xml_chain(xml_tag *tag, const waypoint *wpt) +fprint_xml_chain(xml_tag* tag, const waypoint* wpt) { - char *tmp_ent; + char* tmp_ent; while (tag) { if (!tag->cdata && !tag->child) { fprint_tag_and_attrs("<", " />", tag); @@ -1314,10 +1314,10 @@ fprint_xml_chain(xml_tag *tag, const waypoint *wpt) } } -void free_gpx_extras(xml_tag *tag) +void free_gpx_extras(xml_tag* tag) { - xml_tag *next = NULL; - char **ap; + xml_tag* next = NULL; + char** ap; while (tag) { if (tag->cdata) { @@ -1352,17 +1352,17 @@ void free_gpx_extras(xml_tag *tag) * Handle the grossness of GPX 1.0 vs. 1.1 handling of linky links. */ static void -write_gpx_url(const waypoint *waypointp) +write_gpx_url(const waypoint* waypointp) { - char *tmp_ent; + char* tmp_ent; if (waypointp->url == NULL) { return; } if (gpx_wversion_num > 10) { - url_link *tail; - for (tail = (url_link *)&waypointp->url_next; tail; tail = tail->url_next) { + url_link* tail; + for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_next) { tmp_ent = xml_entitize(tail->url); gbfprintf(ofd, " \n", urlbase ? urlbase : "", tmp_ent); @@ -1387,9 +1387,9 @@ write_gpx_url(const waypoint *waypointp) * Order counts. */ static void -gpx_write_common_acc(const waypoint *waypointp, const char *indent) +gpx_write_common_acc(const waypoint* waypointp, const char* indent) { - char *fix = NULL; + char* fix = NULL; switch (waypointp->fix) { case fix_2d: @@ -1430,7 +1430,7 @@ gpx_write_common_acc(const waypoint *waypointp, const char *indent) } static void -gpx_write_common_position(const waypoint *waypointp, const char *indent) +gpx_write_common_position(const waypoint* waypointp, const char* indent) { if (waypointp->altitude != unknown_alt) { gbfprintf(ofd, "%s%f\n", @@ -1442,8 +1442,8 @@ gpx_write_common_position(const waypoint *waypointp, const char *indent) } static void -gpx_write_common_description(const waypoint *waypointp, const char *indent, - const char *oname) +gpx_write_common_description(const waypoint* waypointp, const char* indent, + const char* oname) { write_optional_xml_entity(ofd, indent, "name", oname); write_optional_xml_entity(ofd, indent, "cmt", waypointp->description); @@ -1457,12 +1457,12 @@ gpx_write_common_description(const waypoint *waypointp, const char *indent, } static void -gpx_waypt_pr(const waypoint *waypointp) +gpx_waypt_pr(const waypoint* waypointp) { - const char *oname; - char *odesc; - fs_xml *fs_gpx; - garmin_fs_t *gmsd; /* gARmIN sPECIAL dATA */ + const char* oname; + char* odesc; + fs_xml* fs_gpx; + garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */ /* * Desparation time, try very hard to get a good shortname @@ -1487,7 +1487,7 @@ gpx_waypt_pr(const waypoint *waypointp) gpx_write_common_description(waypointp, " ", oname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); gmsd = GMSD_FIND(waypointp); if (fs_gpx) { if (! gmsd) { @@ -1502,9 +1502,9 @@ gpx_waypt_pr(const waypoint *waypointp) } static void -gpx_track_hdr(const route_head *rte) +gpx_track_hdr(const route_head* rte) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, "\n"); write_optional_xml_entity(ofd, " ", "name", rte->rte_name); @@ -1514,16 +1514,16 @@ gpx_track_hdr(const route_head *rte) } gbfprintf(ofd, "\n"); - fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, NULL); } } static void -gpx_track_disp(const waypoint *waypointp) +gpx_track_disp(const waypoint* waypointp) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, "\n", waypointp->latitude, @@ -1551,7 +1551,7 @@ gpx_track_disp(const waypoint *waypointp) NULL : waypointp->shortname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } @@ -1560,7 +1560,7 @@ gpx_track_disp(const waypoint *waypointp) } static void -gpx_track_tlr(const route_head *rte) +gpx_track_tlr(const route_head* rte) { gbfprintf(ofd, "\n"); gbfprintf(ofd, "\n"); @@ -1573,9 +1573,9 @@ void gpx_track_pr() } static void -gpx_route_hdr(const route_head *rte) +gpx_route_hdr(const route_head* rte) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, "\n"); write_optional_xml_entity(ofd, " ", "name", rte->rte_name); @@ -1584,16 +1584,16 @@ gpx_route_hdr(const route_head *rte) gbfprintf(ofd, " %d\n", rte->rte_num); } - fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, NULL); } } static void -gpx_route_disp(const waypoint *waypointp) +gpx_route_disp(const waypoint* waypointp) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, " \n", waypointp->latitude, @@ -1603,7 +1603,7 @@ gpx_route_disp(const waypoint *waypointp) gpx_write_common_description(waypointp, " ", waypointp->shortname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } @@ -1612,7 +1612,7 @@ gpx_route_disp(const waypoint *waypointp) } static void -gpx_route_tlr(const route_head *rte) +gpx_route_tlr(const route_head* rte) { gbfprintf(ofd, "\n"); } @@ -1625,7 +1625,7 @@ void gpx_route_pr() } static void -gpx_waypt_bound_calc(const waypoint *waypointp) +gpx_waypt_bound_calc(const waypoint* waypointp) { waypt_add_to_bounds(&all_bounds, waypointp); } diff --git a/gpsbabel/garmin_fs.c b/gpsbabel/garmin_fs.c index a893d7413..1ff788268 100644 --- a/gpsbabel/garmin_fs.c +++ b/gpsbabel/garmin_fs.c @@ -34,12 +34,12 @@ "xsi:schemaLocation=\"http://www.garmin.com/xmlschemas/GpxExtensions/v3 " \ "http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd" -garmin_fs_t * +garmin_fs_t* garmin_fs_alloc(const int protocol) { - garmin_fs_t *result = NULL; + garmin_fs_t* result = NULL; - result = (garmin_fs_t *)xcalloc(1, sizeof(*result)); + result = (garmin_fs_t*)xcalloc(1, sizeof(*result)); result->fs.type = FS_GMSD; result->fs.copy = (fs_copy) garmin_fs_copy; result->fs.destroy = garmin_fs_destroy; @@ -52,11 +52,11 @@ garmin_fs_alloc(const int protocol) } void -garmin_fs_destroy(void *fs) +garmin_fs_destroy(void* fs) { - garmin_fs_t *data = (garmin_fs_t *) fs; + garmin_fs_t* data = (garmin_fs_t*) fs; if (data != NULL) { - garmin_ilink_t *ilinks; + garmin_ilink_t* ilinks; if (data->addr != NULL) { xfree(data->addr); @@ -99,7 +99,7 @@ garmin_fs_destroy(void *fs) ilinks->ref_count--; if (ilinks->ref_count <= 0) { while (ilinks != NULL) { - garmin_ilink_t *tmp = ilinks; + garmin_ilink_t* tmp = ilinks; ilinks = ilinks->next; xfree(tmp); } @@ -109,13 +109,13 @@ garmin_fs_destroy(void *fs) } } -void garmin_fs_copy(garmin_fs_t **dest, garmin_fs_t *src) +void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src) { if (src == NULL) { *dest = NULL; return; } - *dest = (garmin_fs_t *) xmalloc(sizeof(*src)); + *dest = (garmin_fs_t*) xmalloc(sizeof(*src)); /* do not copy interlinks, only increment the refrence counter */ if (src->ilinks != NULL) { @@ -138,9 +138,9 @@ void garmin_fs_copy(garmin_fs_t **dest, garmin_fs_t *src) (*dest)->state = (src->state != NULL) ? xstrdup(src->state) : NULL; } -void garmin_fs_convert(void *fs) +void garmin_fs_convert(void* fs) { - garmin_fs_t *gmsd = (garmin_fs_t *) fs; + garmin_fs_t* gmsd = (garmin_fs_t*) fs; if (gmsd->addr) { gmsd->addr = cet_convert_string(gmsd->addr); @@ -183,10 +183,10 @@ void garmin_fs_convert(void *fs) /* GPX - out */ void -garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) +garmin_fs_xml_fprint(gbfile* ofd, const waypoint* waypt) { - const char *phone, *addr; - garmin_fs_t *gmsd = GMSD_FIND(waypt); + const char* phone, *addr; + garmin_fs_t* gmsd = GMSD_FIND(waypt); if (gmsd == NULL) { return; @@ -229,7 +229,7 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) gbfprintf(ofd, "%*s%.6f\n", space * 2, "", waypt->depth); } if (gmsd->flags.display) { - char *cx; + char* cx; switch (gmsd->display) { case gt_display_mode_symbol: cx = "SymbolOnly"; @@ -256,7 +256,7 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) gbfprintf(ofd, "%*s\n", --space * 2, ""); } if (*addr) { - char *str, *tmp; + char* str, *tmp; gbfprintf(ofd, "%*s\n", space++ * 2, ""); if ((str = GMSD_GET(addr, NULL))) { @@ -289,7 +289,7 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) } if (*phone) { - char *tmp = xml_entitize(phone); + char* tmp = xml_entitize(phone); gbfprintf(ofd, "%*s%s\n", space * 2, "", tmp); xfree(tmp); } @@ -301,14 +301,14 @@ garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt) } void -garmin_fs_xml_convert(const int base_tag, int tag, const char *cdatastr, waypoint *waypt) +garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatastr, waypoint* waypt) { - garmin_fs_t *gmsd; + garmin_fs_t* gmsd; gmsd = GMSD_FIND(waypt); if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&waypt->fs, (format_specific_data *) gmsd); + fs_chain_add(&waypt->fs, (format_specific_data*) gmsd); } tag -= base_tag; @@ -379,7 +379,7 @@ garmin_fs_xml_convert(const int base_tag, int tag, const char *cdatastr, waypoin } unsigned char -garmin_fs_convert_category(const char *category_name, gbuint16 *category) +garmin_fs_convert_category(const char* category_name, gbuint16* category) { int i; int cat = 0; @@ -390,7 +390,7 @@ garmin_fs_convert_category(const char *category_name, gbuint16 *category) cat = (1 << --i); } else if (global_opts.inifile != NULL) { for (i = 0; i < 16; i++) { - char *c; + char* c; char key[3]; snprintf(key, sizeof(key), "%d", i + 1); @@ -410,10 +410,10 @@ garmin_fs_convert_category(const char *category_name, gbuint16 *category) } unsigned char -garmin_fs_merge_category(const char *category_name, waypoint *waypt) +garmin_fs_merge_category(const char* category_name, waypoint* waypt) { gbuint16 cat; - garmin_fs_t *gmsd; + garmin_fs_t* gmsd; if (!garmin_fs_convert_category(category_name, &cat)) { return 0; @@ -424,19 +424,19 @@ garmin_fs_merge_category(const char *category_name, waypoint *waypt) if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&waypt->fs, (format_specific_data *) gmsd); + fs_chain_add(&waypt->fs, (format_specific_data*) gmsd); } GMSD_SET(category, cat); return 1; } void -garmin_fs_garmin_after_read(const GPS_PWay way, waypoint *wpt, const int protoid) +garmin_fs_garmin_after_read(const GPS_PWay way, waypoint* wpt, const int protoid) { - garmin_fs_t *gmsd = NULL; + garmin_fs_t* gmsd = NULL; gmsd = garmin_fs_alloc(protoid); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); /* nothing happens until gmsd is allocated some lines above */ @@ -466,9 +466,9 @@ garmin_fs_garmin_after_read(const GPS_PWay way, waypoint *wpt, const int protoid } void -garmin_fs_garmin_before_write(const waypoint *wpt, GPS_PWay way, const int protoid) +garmin_fs_garmin_before_write(const waypoint* wpt, GPS_PWay way, const int protoid) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); if (gmsd == NULL) { return; diff --git a/gpsbabel/garmin_fs.h b/gpsbabel/garmin_fs.h index 1f9b87484..c3f994d0e 100644 --- a/gpsbabel/garmin_fs.h +++ b/gpsbabel/garmin_fs.h @@ -61,7 +61,7 @@ typedef struct garmin_ilink_s { int ref_count; double lat, lon, alt; - struct garmin_ilink_s *next; + struct garmin_ilink_s* next; } garmin_ilink_t; typedef struct { @@ -96,45 +96,45 @@ typedef struct garmin_fs_s { int wpt_class; gbint32 display; gbint16 category; - char *city; /* city name */ - char *facility; /* facility name */ - char *state; /* state */ - char *cc; /* country code */ - char *cross_road; /* Intersection road label */ - char *addr; /* address + number */ - char *country; /* country */ - char *phone_nr; /* phone number */ - char *phone_nr2; /* phone number (2) */ - char *fax_nr; /* fax number */ - char *postal_code; /* postal code */ - char *email; /* email address */ - garmin_ilink_t *ilinks; + char* city; /* city name */ + char* facility; /* facility name */ + char* state; /* state */ + char* cc; /* country code */ + char* cross_road; /* Intersection road label */ + char* addr; /* address + number */ + char* country; /* country */ + char* phone_nr; /* phone number */ + char* phone_nr2; /* phone number (2) */ + char* fax_nr; /* fax number */ + char* postal_code; /* postal code */ + char* email; /* email address */ + garmin_ilink_t* ilinks; #ifdef GMSD_EXPERIMENTAL char subclass[22]; #endif } garmin_fs_t, *garmin_fs_p; -garmin_fs_t *garmin_fs_alloc(const int protocol); -void garmin_fs_destroy(void *fs); -void garmin_fs_copy(garmin_fs_t **dest, garmin_fs_t *src); -void garmin_fs_convert(void *fs); -char *garmin_fs_xstrdup(const char *src, size_t size); +garmin_fs_t* garmin_fs_alloc(const int protocol); +void garmin_fs_destroy(void* fs); +void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src); +void garmin_fs_convert(void* fs); +char* garmin_fs_xstrdup(const char* src, size_t size); /* for GPX */ -void garmin_fs_xml_convert(const int base_tag, int tag, const char *cdatastr, waypoint *waypt); -void garmin_fs_xml_fprint(gbfile *ofd, const waypoint *waypt); +void garmin_fs_xml_convert(const int base_tag, int tag, const char* cdatastr, waypoint* waypt); +void garmin_fs_xml_fprint(gbfile* ofd, const waypoint* waypt); /* common garmin_fs utilities */ /* ..convert_category: returns 1=OK; 0=Unable to convert category */ -unsigned char garmin_fs_convert_category(const char *category_name, gbuint16 *category); +unsigned char garmin_fs_convert_category(const char* category_name, gbuint16* category); /* ..merge_category: returns 1=OK; 0=Unable to convert category */ -unsigned char garmin_fs_merge_category(const char *category_name, waypoint *waypt); +unsigned char garmin_fs_merge_category(const char* category_name, waypoint* waypt); #define GMSD_SECTION_CATEGORIES "Garmin Categories" -void garmin_fs_garmin_after_read(const GPS_PWay way, waypoint *wpt, const int protoid); -void garmin_fs_garmin_before_write(const waypoint *wpt, GPS_PWay way, const int protoid); +void garmin_fs_garmin_after_read(const GPS_PWay way, waypoint* wpt, const int protoid); +void garmin_fs_garmin_before_write(const waypoint* wpt, GPS_PWay way, const int protoid); #endif diff --git a/gpsbabel/garmin_gpi.c b/gpsbabel/garmin_gpi.c index 308be6e82..9f2930079 100644 --- a/gpsbabel/garmin_gpi.c +++ b/gpsbabel/garmin_gpi.c @@ -68,8 +68,8 @@ #define GPI_ADDR_POSTAL_CODE 8 #define GPI_ADDR_ADDR 16 -static char *opt_cat, *opt_pos, *opt_notes, *opt_hide_bitmap, *opt_descr, *opt_bitmap; -static char *opt_unique, *opt_alerts, *opt_units, *opt_speed, *opt_proximity, *opt_sleep; +static char* opt_cat, *opt_pos, *opt_notes, *opt_hide_bitmap, *opt_descr, *opt_bitmap; +static char* opt_unique, *opt_alerts, *opt_units, *opt_speed, *opt_proximity, *opt_sleep; static double defspeed, defproximity; static int alerts; @@ -131,8 +131,8 @@ typedef struct { time_t crdate; /* creation date and time */ char POI[4]; /* "POI" */ char S8[3]; - char *group; - char *category; + char* group; + char* category; } reader_data_t; typedef struct writer_data_s { @@ -141,16 +141,16 @@ typedef struct writer_data_s { int sz; int alert; bounds bds; - struct writer_data_s *top_left; - struct writer_data_s *top_right; - struct writer_data_s *buttom_left; - struct writer_data_s *buttom_right; + struct writer_data_s* top_left; + struct writer_data_s* top_right; + struct writer_data_s* buttom_left; + struct writer_data_s* buttom_right; } writer_data_t; typedef struct gpi_waypt_data_s { int sz; - char *addr; - char *postal_code; + char* addr; + char* postal_code; } gpi_waypt_data_t; typedef struct { @@ -191,18 +191,18 @@ typedef struct { int alerts; short mask; char addr_is_dynamic; - char *addr; - char *city; - char *country; - char *phone_nr; - char *postal_code; - char *state; + char* addr; + char* city; + char* country; + char* phone_nr; + char* postal_code; + char* state; } gpi_waypt_t; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static gbint16 codepage; /* code-page, i.e. 1252 */ -static reader_data_t *rdata; -static writer_data_t *wdata; +static reader_data_t* rdata; +static writer_data_t* wdata; static short_handle short_h; static char units; static time_t gpi_timestamp = 0; @@ -219,26 +219,26 @@ static time_t gpi_timestamp = 0; *******************************************************************************/ /* look for or initialize GMSD */ -static garmin_fs_t * -gpi_gmsd_init(waypoint *wpt) +static garmin_fs_t* +gpi_gmsd_init(waypoint* wpt) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); if (wpt == NULL) { fatal(MYNAME ": Error in file structure.\n"); } if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } return gmsd; } /* read a standard string with or without 'EN' (or whatever) header */ -static char * -gpi_read_string(const char *field) +static char* +gpi_read_string(const char* field) { int l1; - char *res = NULL; + char* res = NULL; l1 = gbfgetint16(fin); if (l1 > 0) { @@ -260,14 +260,14 @@ gpi_read_string(const char *field) if ((en[0] < 'A') || (en[0] > 'Z') || (en[1] < 'A') || (en[1] > 'Z')) { fatal(MYNAME ": Invalid country code!\n"); } - res = xmalloc(l2 + 1); + res = (char*) xmalloc(l2 + 1); res[l2] = '\0'; PP; if (l2 > 0) { gbfread(res, 1, l2, fin); } } else { - res = xmalloc(l1 + 1); + res = (char*) xmalloc(l1 + 1); *res = first; *(res + l1) = '\0'; PP; @@ -351,7 +351,7 @@ read_header(void) } /* gpi tag handler */ -static int read_tag(const char *caller, const int tag, waypoint *wpt); +static int read_tag(const char* caller, const int tag, waypoint* wpt); /* read a single poi with all options */ @@ -359,7 +359,7 @@ static void read_poi(const int sz, const int tag) { int pos, len; - waypoint *wpt; + waypoint* wpt; #ifdef GPI_DBG PP; @@ -492,13 +492,13 @@ read_poi_group(const int sz, const int tag) // length field) /* gpi tag handler */ static int -read_tag(const char *caller, const int tag, waypoint *wpt) +read_tag(const char* caller, const int tag, waypoint* wpt) { int pos, sz, dist; double speed; short mask; - char *str; - garmin_fs_t *gmsd; + char* str; + garmin_fs_t* gmsd; sz = gbfgetint32(fin); pos = gbftell(fin); @@ -673,7 +673,7 @@ read_tag(const char *caller, const int tag, waypoint *wpt) #ifdef GPI_DBG { int x; - unsigned char *b = xmalloc(sz); + unsigned char* b = xmalloc(sz); fprintf(stderr, "Tag: %x\n", tag); gbfread(b, 1, sz, fin); fprintf(stderr, "\n"); @@ -701,7 +701,7 @@ read_tag(const char *caller, const int tag, waypoint *wpt) *******************************************************************************/ static void -write_string(const char *str, const char long_format) +write_string(const char* str, const char long_format) { int len; @@ -716,17 +716,17 @@ write_string(const char *str, const char long_format) static int -compare_wpt_cb(const queue *a, const queue *b) +compare_wpt_cb(const queue* a, const queue* b) { - const waypoint *wa = (waypoint *) a; - const waypoint *wb = (waypoint *) b; + const waypoint* wa = (waypoint*) a; + const waypoint* wb = (waypoint*) b; return strcmp(wa->shortname, wb->shortname); } static char -compare_strings(const char *s1, const char *s2) +compare_strings(const char* s1, const char* s2) { if (s1 == s2) { return 0; @@ -742,12 +742,12 @@ compare_strings(const char *s1, const char *s2) } -static writer_data_t * +static writer_data_t* wdata_alloc() { - writer_data_t *res; + writer_data_t* res; - res = xcalloc(1, sizeof(*res)); + res = (writer_data_t*) xcalloc(1, sizeof(*res)); QUEUE_INIT(&res->Q); waypt_init_bounds(&res->bds); @@ -756,15 +756,15 @@ wdata_alloc() static void -wdata_free(writer_data_t *data) +wdata_free(writer_data_t* data) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; if (wpt->extra_data) { - gpi_waypt_t *dt = (gpi_waypt_t *) wpt->extra_data; + gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data; if (dt->addr_is_dynamic) { xfree(dt->addr); } @@ -791,7 +791,7 @@ wdata_free(writer_data_t *data) static void -wdata_add_wpt(writer_data_t *data, waypoint *wpt) +wdata_add_wpt(writer_data_t* data, waypoint* wpt) { data->ct++; ENQUEUE_TAIL(&data->Q, &wpt->Q); @@ -800,9 +800,9 @@ wdata_add_wpt(writer_data_t *data, waypoint *wpt) static void -wdata_check(writer_data_t *data) +wdata_check(writer_data_t* data) { - queue *elem, *tmp; + queue* elem, *tmp; double center_lat, center_lon; if ((data->ct <= WAYPOINTS_PER_BLOCK) || @@ -819,7 +819,7 @@ wdata_check(writer_data_t *data) center_lat = center_lon = 0; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - waypoint *wpt = (waypoint *) elem; + waypoint* wpt = (waypoint*) elem; center_lat += wpt->latitude; center_lon += wpt->longitude; } @@ -827,8 +827,8 @@ wdata_check(writer_data_t *data) center_lon /= data->ct; QUEUE_FOR_EACH(&data->Q, elem, tmp) { - waypoint *wpt = (waypoint *) elem; - writer_data_t **ref; + waypoint* wpt = (waypoint*) elem; + writer_data_t** ref; if (wpt->latitude < center_lat) { if (wpt->longitude < center_lon) { @@ -870,18 +870,18 @@ wdata_check(writer_data_t *data) static int -wdata_compute_size(writer_data_t *data) +wdata_compute_size(writer_data_t* data) { - queue *elem, *tmp; + queue* elem, *tmp; int res; res = 23; /* bounds, ... of tag 0x80008 */ QUEUE_FOR_EACH(&data->Q, elem, tmp) { - waypoint *wpt = (waypoint *) elem; - gpi_waypt_t *dt; - garmin_fs_t *gmsd; - char *str; + waypoint* wpt = (waypoint*) elem; + gpi_waypt_t* dt; + garmin_fs_t* gmsd; + char* str; res += 12; /* tag/sz/sub-sz */ res += 19; /* poi fixed size */ @@ -890,11 +890,11 @@ wdata_compute_size(writer_data_t *data) res += 10; /* tag(4) */ } - dt = xcalloc(1, sizeof(*dt)); + dt = (gpi_waypt_t*) xcalloc(1, sizeof(*dt)); wpt->extra_data = dt; if (alerts) { - char *pos; + char* pos; if ((pos = strchr(wpt->shortname, '@'))) { double speed, scale; @@ -1012,9 +1012,9 @@ wdata_compute_size(writer_data_t *data) static void -wdata_write(const writer_data_t *data) +wdata_write(const writer_data_t* data) { - queue *elem, *tmp; + queue* elem, *tmp; gbfputint32(0x80008, fout); gbfputint32(data->sz, fout); @@ -1030,10 +1030,10 @@ wdata_write(const writer_data_t *data) gbfputc(data->alert, fout); QUEUE_FOR_EACH(&data->Q, elem, tmp) { - char *str; + char* str; int s0, s1; - waypoint *wpt = (waypoint *)elem; - gpi_waypt_t *dt = wpt->extra_data; + waypoint* wpt = (waypoint*)elem; + gpi_waypt_t* dt = (gpi_waypt_t*) wpt->extra_data; str = wpt->description; if (! str) { @@ -1156,7 +1156,7 @@ wdata_write(const writer_data_t *data) static void -write_category(const char *category, const char *image, const int image_sz) +write_category(const char* category, const char* image, const int image_sz) { int sz; @@ -1216,14 +1216,14 @@ write_header(void) static void -enum_waypt_cb(const waypoint *ref) +enum_waypt_cb(const waypoint* ref) { - waypoint *wpt; - char *str; - queue *elem, *tmp; + waypoint* wpt; + char* str; + queue* elem, *tmp; QUEUE_FOR_EACH(&wdata->Q, elem, tmp) { - waypoint *cmp = (waypoint *) elem; + waypoint* cmp = (waypoint*) elem; /* sort out nearly equal waypoints */ if ((compare_strings(cmp->shortname, ref->shortname) == 0) && @@ -1248,16 +1248,16 @@ enum_waypt_cb(const waypoint *ref) static void -load_bitmap_from_file(const char *fname, char **data, int *data_sz) +load_bitmap_from_file(const char* fname, char** data, int* data_sz) { - gbfile *f; + gbfile* f; int i, sz; int dest_bpp; int src_line_sz, dest_line_sz; bmp_header_t src_h; - int *color_table = NULL; - gpi_bitmap_header_t *dest_h; - char *ptr; + int* color_table = NULL; + gpi_bitmap_header_t* dest_h; + char* ptr; f = gbfopen_le(fname, "rb", MYNAME); is_fatal(gbfgetint16(f) != 0x4d42, MYNAME ": No BMP image."); @@ -1313,7 +1313,7 @@ load_bitmap_from_file(const char *fname, char **data, int *data_sz) } if (src_h.used_colors > 0) { - color_table = xmalloc(4 * src_h.used_colors); + color_table = (int*) xmalloc(4 * src_h.used_colors); gbfread(color_table, 1, 4 * src_h.used_colors, f); for (i = 0; i < src_h.used_colors; i++) { int color = color_table[i]; @@ -1341,8 +1341,8 @@ load_bitmap_from_file(const char *fname, char **data, int *data_sz) sz += (src_h.used_colors * 4); } - ptr = xmalloc(sz); - dest_h = (void *)ptr; + ptr = (char*) xmalloc(sz); + dest_h = (gpi_bitmap_header_t*)ptr; *data = ptr; *data_sz = sz; @@ -1360,14 +1360,14 @@ load_bitmap_from_file(const char *fname, char **data, int *data_sz) le_write32(&dest_h->size_2c, (dest_line_sz * src_h.height) + 0x2c); /* copy and revert order of BMP lines */ - ptr = (void *)dest_h; + ptr = (char*)dest_h; ptr += (sizeof(*dest_h) + (dest_line_sz * (src_h.height - 1))); if (src_h.bpp == 24) { /* 24 bpp seems to be not supported, convert to 32 bpp */ for (i = 0; i < src_h.height; i++) { int j; - char *p = ptr; + char* p = ptr; for (j = 0; j < src_h.width; j++) { int color; @@ -1386,7 +1386,7 @@ load_bitmap_from_file(const char *fname, char **data, int *data_sz) } if (src_h.used_colors > 0) { - ptr = (void *)dest_h; + ptr = (char*)dest_h; ptr += (sizeof(*dest_h) + (src_h.height * src_line_sz)); for (i = 0; i < src_h.used_colors; i++) { @@ -1406,12 +1406,12 @@ load_bitmap_from_file(const char *fname, char **data, int *data_sz) *******************************************************************************/ static void -garmin_gpi_rd_init(const char *fname) +garmin_gpi_rd_init(const char* fname) { char cp[8]; fin = gbfopen_le(fname, "rb", MYNAME); - rdata = xcalloc(1, sizeof(*rdata)); + rdata = (reader_data_t*) xcalloc(1, sizeof(*rdata)); read_header(); @@ -1430,10 +1430,10 @@ garmin_gpi_rd_init(const char *fname) static void -garmin_gpi_wr_init(const char *fname) +garmin_gpi_wr_init(const char* fname) { char cp[8]; - cet_cs_vec_t *vec; + cet_cs_vec_t* vec; int i; if (gpi_timestamp != 0) { /* not the first gpi output session */ @@ -1559,7 +1559,7 @@ garmin_gpi_read(void) static void garmin_gpi_write(void) { - char *image; + char* image; int image_sz; if (strlen(opt_cat) == 0) { @@ -1594,7 +1594,7 @@ garmin_gpi_write(void) ff_vecs_t garmin_gpi_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, ff_cap_none /* routes */ }, diff --git a/gpsbabel/garmin_tables.c b/gpsbabel/garmin_tables.c index 73cebf770..161f15c56 100644 --- a/gpsbabel/garmin_tables.c +++ b/gpsbabel/garmin_tables.c @@ -577,7 +577,7 @@ gt_country_code_t gt_country_codes[] = { }; /* gt_waypt_classes: gdb internal order */ -char *gt_waypt_class_names[] = { +char* gt_waypt_class_names[] = { "User Waypoint", "Airport", "Intersection", @@ -595,15 +595,15 @@ char *gt_waypt_class_names[] = { }; /* gt_display_mode_names: this order is used by most devices */ -char *gt_display_mode_names[] = { +char* gt_display_mode_names[] = { "Symbol & Name", "Symbol", "Symbol & Description" }; typedef struct { - const char *shortname; - const char *longname; + const char* shortname; + const char* longname; grid_type grid; } grid_mapping_t; @@ -622,8 +622,8 @@ grid_mapping_t gt_mps_grid_names[] = { /* gt_mps_datum_names: */ typedef struct { - const char *jeeps_name; - const char *mps_name; + const char* jeeps_name; + const char* mps_name; } datum_mapping_t; /* will be continued (when requested) */ @@ -644,7 +644,7 @@ static datum_mapping_t gt_mps_datum_names[] = { }; typedef struct garmin_color_s { - const char *name; + const char* name; gbint32 rgb; } garmin_color_t; @@ -729,10 +729,10 @@ gt_switch_display_mode_value(const unsigned char display_mode, const int protoid } } -char * -gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic) +char* +gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic) { - icon_mapping_t *i; + icon_mapping_t* i; char custom[] = "Custom 63 "; if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563)) { @@ -756,13 +756,13 @@ gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, in case MAPSOURCE: case GDB: if (icon == i->mpssymnum) { - return (char *)i->icon; + return (char*)i->icon; } break; case PCX: case GARMIN_SERIAL: if (icon == i->pcxsymnum) { - return (char *)i->icon; + return (char*)i->icon; } break; default: @@ -772,10 +772,10 @@ gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, in return DEFAULT_ICON_DESCR; } -int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format) +int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin_format) { static int find_flag = 0; - icon_mapping_t *i; + icon_mapping_t* i; int def_icon = DEFAULT_ICON_VALUE; int n; @@ -841,8 +841,8 @@ int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_form */ if (find_flag == 0) { - char **prefix; - char *prefixes[] = {"White ", "Red ", "Green ", "Blue ", "Black ", NULL}; + char** prefix; + char* prefixes[] = {"White ", "Red ", "Green ", "Blue ", "Black ", NULL}; for (prefix = prefixes; *prefix != NULL; prefix++) { int len = strlen(*prefix); @@ -865,17 +865,17 @@ int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_form return def_icon; } -const char * -gt_get_icao_country(const char *cc) +const char* +gt_get_icao_country(const char* cc) { - gt_country_code_t *x = >_country_codes[0]; + gt_country_code_t* x = >_country_codes[0]; if ((cc == NULL) || (*cc == '\0')) { return NULL; } do { - const char *ccx = x->cc; + const char* ccx = x->cc; while (ccx != NULL) { if (strncmp(ccx, cc, 2) == 0) { return x->country; @@ -894,14 +894,14 @@ gt_get_icao_country(const char *cc) return NULL; } -const char * -gt_get_icao_cc(const char *country, const char *shortname) +const char* +gt_get_icao_cc(const char* country, const char* shortname) { static char res[3]; - gt_country_code_t *x = >_country_codes[0]; + gt_country_code_t* x = >_country_codes[0]; if ((country == NULL) || (*country == '\0')) { - const char *test; + const char* test; if (shortname == NULL) { return NULL; } @@ -939,7 +939,7 @@ gt_get_icao_cc(const char *country, const char *shortname) return res; } if (shortname && (strlen(shortname) == 4)) { - const char *ccx = x->cc; + const char* ccx = x->cc; strncpy(res, shortname, 2); res[2] = '\0'; @@ -963,9 +963,9 @@ gt_get_icao_cc(const char *country, const char *shortname) } grid_type -gt_lookup_grid_type(const char *grid_name, const char *module) +gt_lookup_grid_type(const char* grid_name, const char* module) { - grid_mapping_t *g; + grid_mapping_t* g; for (g = gt_mps_grid_names; (g->shortname); g++) { if ((case_ignore_strcmp(grid_name, g->shortname) == 0) || @@ -980,8 +980,8 @@ gt_lookup_grid_type(const char *grid_name, const char *module) return grid_unknown; /* (warnings) */ } -const char * -gt_get_mps_grid_longname(const grid_type grid, const char *module) +const char* +gt_get_mps_grid_longname(const grid_type grid, const char* module) { if ((grid < GRID_INDEX_MIN) || (grid > GRID_INDEX_MAX)) fatal("%s: Grid index out of range %d (%d..%d)!", @@ -990,11 +990,11 @@ gt_get_mps_grid_longname(const grid_type grid, const char *module) return gt_mps_grid_names[grid].longname; } -const char * +const char* gt_get_mps_datum_name(const int datum_index) { - char *result; - datum_mapping_t *d; + char* result; + datum_mapping_t* d; result = GPS_Math_Get_Datum_Name(datum_index); @@ -1007,11 +1007,11 @@ gt_get_mps_datum_name(const int datum_index) } int -gt_lookup_datum_index(const char *datum_str, const char *module) +gt_lookup_datum_index(const char* datum_str, const char* module) { - datum_mapping_t *d; + datum_mapping_t* d; int result; - const char *name = datum_str; + const char* name = datum_str; for (d = gt_mps_datum_names; (d->jeeps_name); d++) { if (case_ignore_strcmp(name, d->mps_name) == 0) { @@ -1023,7 +1023,7 @@ gt_lookup_datum_index(const char *datum_str, const char *module) result = GPS_Lookup_Datum_Index(name); if (result < 0) { - char *tmp; + char* tmp; xasprintf(&tmp, "%s mean", datum_str); result = GPS_Lookup_Datum_Index(tmp); xfree(tmp); @@ -1047,7 +1047,7 @@ gt_color_value(const int garmin_index) } gbuint32 -gt_color_value_by_name(const char *name) +gt_color_value_by_name(const char* name) { int i; @@ -1060,7 +1060,7 @@ gt_color_value_by_name(const char *name) } int -gt_color_index_by_name(const char *name) +gt_color_index_by_name(const char* name) { int i; @@ -1085,7 +1085,7 @@ gt_color_index_by_rgb(const int rgb) return 0; /* unknown */ } -const char * +const char* gt_color_name(const int garmin_index) { if ((garmin_index >= 0) && (garmin_index < GT_COLORS_CT)) { @@ -1102,17 +1102,17 @@ gt_color_name(const int garmin_index) * cc -DMAKE_TABLE garmin_tables.c fatal.o util.o globals.o -lm */ -int cet_utf8_to_ucs4(const char *str, int *bytes, int *value) +int cet_utf8_to_ucs4(const char* str, int* bytes, int* value) { fatal("Should not be here."); } int -sortem(const void *a, const void *b) +sortem(const void* a, const void* b) { - const icon_mapping_t *aa = a; - const icon_mapping_t *bb = b; + const icon_mapping_t* aa = a; + const icon_mapping_t* bb = b; // return aa->mpssymnum - bb->mpssymnum; return strcmp(aa->icon, bb->icon); @@ -1121,7 +1121,7 @@ sortem(const void *a, const void *b) main() { - icon_mapping_t *i; + icon_mapping_t* i; qsort(garmin_icon_table, sizeof(garmin_icon_table) / sizeof(garmin_icon_table[0]) - 1, sizeof(garmin_icon_table[0]), sortem); for (i = garmin_icon_table; i->icon; i++) { // printf("%03d\t%s\n", i->mpssymnum, i->icon); diff --git a/gpsbabel/garmin_tables.h b/gpsbabel/garmin_tables.h index 0fd88f0f9..8a010904e 100644 --- a/gpsbabel/garmin_tables.h +++ b/gpsbabel/garmin_tables.h @@ -31,13 +31,13 @@ typedef struct icon_mapping { const int mpssymnum; const int pcxsymnum; - const char *icon; + const char* icon; } icon_mapping_t; typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e; -char *gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic); -int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format); +char* gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int* dynamic); +int gt_find_icon_number_from_desc(const char* desc, garmin_formats_e garmin_format); extern icon_mapping_t garmin_icon_table[]; @@ -57,17 +57,17 @@ typedef enum { gt_waypt_class_map_line } gt_waypt_classes_e; -extern char *gt_waypt_class_names[]; +extern char* gt_waypt_class_names[]; typedef struct gt_country_code_s { - const char *cc; - const char *country; + const char* cc; + const char* country; } gt_country_code_t; extern gt_country_code_t gt_country_codes[]; -const char *gt_get_icao_country(const char *cc); -const char *gt_get_icao_cc(const char *country, const char *shortname); +const char* gt_get_icao_country(const char* cc); +const char* gt_get_icao_cc(const char* country, const char* shortname); /* this order is used by most devices */ typedef enum { @@ -76,7 +76,7 @@ typedef enum { gt_display_mode_symbol_and_comment } gt_display_modes_e; -extern char *gt_display_mode_names[]; +extern char* gt_display_mode_names[]; #define GT_DISPLAY_MODE_MIN gt_display_mode_symbol_and_name #define GT_DISPLAY_MODE_MAX gt_display_mode_symbol_and_comment @@ -87,18 +87,18 @@ typedef enum { gt_gdb_display_mode_symbol_and_comment } gt_gdb_display_modes_e; -unsigned char gt_convert_category(const char *name, int *category); +unsigned char gt_convert_category(const char* name, int* category); unsigned char gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device); -grid_type gt_lookup_grid_type(const char *grid_name, const char *module); -const char *gt_get_mps_grid_longname(const grid_type grid, const char *module); -int gt_lookup_datum_index(const char *datum_str, const char *module); -const char *gt_get_mps_datum_name(const int datum_index); +grid_type gt_lookup_grid_type(const char* grid_name, const char* module); +const char* gt_get_mps_grid_longname(const grid_type grid, const char* module); +int gt_lookup_datum_index(const char* datum_str, const char* module); +const char* gt_get_mps_datum_name(const int datum_index); gbuint32 gt_color_value(const int garmin_index); -gbuint32 gt_color_value_by_name(const char *name); -int gt_color_index_by_name(const char *name); +gbuint32 gt_color_value_by_name(const char* name); +int gt_color_index_by_name(const char* name); int gt_color_index_by_rgb(const int rgb); -const char *gt_color_name(const int garmin_index); +const char* gt_color_name(const int garmin_index); #endif diff --git a/gpsbabel/garmin_txt.c b/gpsbabel/garmin_txt.c index b6a3279c6..d79662e50 100644 --- a/gpsbabel/garmin_txt.c +++ b/gpsbabel/garmin_txt.c @@ -48,17 +48,17 @@ typedef struct gtxt_flags_s { unsigned int track_header_written:1; } gtxt_flags_t; -static gbfile *fin, *fout; -static route_head *current_trk, *current_rte; +static gbfile* fin, *fout; +static route_head* current_trk, *current_rte; static int waypoints; static int routepoints; -static waypoint **wpt_a; +static waypoint** wpt_a; static int wpt_a_ct; static grid_type grid_index; static int datum_index; -static char *datum_str; +static char* datum_str; static int current_line; -static char *date_time_format = NULL; +static char* date_time_format = NULL; static int precision = 3; static time_t utc_offs = 0; @@ -75,7 +75,7 @@ typedef enum { #define MAX_HEADER_FIELDS 36 -static char *header_lines[unknown_header + 1][MAX_HEADER_FIELDS]; +static char* header_lines[unknown_header + 1][MAX_HEADER_FIELDS]; static int header_fields[unknown_header + 1][MAX_HEADER_FIELDS]; static int header_ct[unknown_header + 1]; @@ -89,14 +89,14 @@ static int header_ct[unknown_header + 1]; #define IS_VALID_ALT(a) (((a) != unknown_alt) && ((a) < GARMIN_UNKNOWN_ALT)) #define DUPSTR(a) (((a) != NULL) && ((a)[0] != 0)) ? xstrdup((a)) : NULL -static char *opt_datum = NULL; -static char *opt_dist = NULL; -static char *opt_temp = NULL; -static char *opt_date_format = NULL; -static char *opt_time_format = NULL; -static char *opt_precision = NULL; -static char *opt_utc = NULL; -static char *opt_grid = NULL; +static char* opt_datum = NULL; +static char* opt_dist = NULL; +static char* opt_temp = NULL; +static char* opt_date_format = NULL; +static char* opt_time_format = NULL; +static char* opt_precision = NULL; +static char* opt_utc = NULL; +static char* opt_grid = NULL; static arglist_t garmin_txt_args[] = { @@ -118,16 +118,16 @@ typedef struct info_s { double speed; double total; int count; - waypoint *prev_wpt; - waypoint *first_wpt; - waypoint *last_wpt; + waypoint* prev_wpt; + waypoint* first_wpt; + waypoint* last_wpt; } info_t; -static info_t *route_info; +static info_t* route_info; static int route_idx; -static info_t *cur_info; +static info_t* cur_info; -static char *headers[] = { +static char* headers[] = { "Name\tDescription\tType\tPosition\tAltitude\tDepth\tProximity\tTemperature\t" "Display Mode\tColor\tSymbol\tFacility\tCity\tState\tCountry\t" "Date Modified\tLink\tCategories", @@ -140,17 +140,17 @@ static char *headers[] = { /* helpers */ -static char * -get_option_val(char *option, char *def) +static char* +get_option_val(char* option, char* def) { - char *c = (option != NULL) ? option : def; + char* c = (option != NULL) ? option : def; return c; } static void init_date_and_time_format(void) { - char *f, *c; + char* f, *c; f = get_option_val(opt_date_format, DEFAULT_DATE_FORMAT); date_time_format = convert_human_date_format(f); @@ -164,7 +164,7 @@ init_date_and_time_format(void) } static void -convert_datum(const waypoint *wpt, double *dest_lat, double *dest_lon) +convert_datum(const waypoint* wpt, double* dest_lat, double* dest_lon) { double alt; @@ -180,7 +180,7 @@ convert_datum(const waypoint *wpt, double *dest_lat, double *dest_lon) /* Waypoint preparation */ static void -enum_waypt_cb(const waypoint *wpt) +enum_waypt_cb(const waypoint* wpt) { garmin_fs_p gmsd; int wpt_class; @@ -195,24 +195,24 @@ enum_waypt_cb(const waypoint *wpt) return; } for (i = 0; i < wpt_a_ct; i++) { /* check for duplicates */ - waypoint *tmp = wpt_a[i]; + waypoint* tmp = wpt_a[i]; if (case_ignore_strcmp(tmp->shortname, wpt->shortname) == 0) { - wpt_a[i] = (waypoint *)wpt; + wpt_a[i] = (waypoint*)wpt; waypoints--; return; } } - wpt_a[wpt_a_ct++] = (waypoint *)wpt; + wpt_a[wpt_a_ct++] = (waypoint*)wpt; } } static int -sort_waypt_cb(const void *a, const void *b) +sort_waypt_cb(const void* a, const void* b) { - const waypoint *wa = *(waypoint **)a; - const waypoint *wb = *(waypoint **)b; + const waypoint* wa = *(waypoint**)a; + const waypoint* wb = *(waypoint**)b; return case_ignore_strcmp(wa->shortname, wb->shortname); } @@ -221,7 +221,7 @@ sort_waypt_cb(const void *a, const void *b) /* common route and track pre-work */ static void -prework_hdr_cb(const route_head *rte) +prework_hdr_cb(const route_head* rte) { cur_info = &route_info[route_idx]; cur_info->prev_wpt = NULL; @@ -230,25 +230,25 @@ prework_hdr_cb(const route_head *rte) } static void -prework_tlr_cb(const route_head *rte) +prework_tlr_cb(const route_head* rte) { cur_info->last_wpt = cur_info->prev_wpt; route_idx++; } static void -prework_wpt_cb(const waypoint *wpt) +prework_wpt_cb(const waypoint* wpt) { - waypoint *prev = cur_info->prev_wpt; + waypoint* prev = cur_info->prev_wpt; if (prev != NULL) { cur_info->time += (wpt->creation_time - prev->creation_time); cur_info->length += waypt_distance_ex(prev, wpt); } else { - cur_info->first_wpt = (waypoint *)wpt; + cur_info->first_wpt = (waypoint*)wpt; cur_info->start = wpt->creation_time; } - cur_info->prev_wpt = (waypoint *)wpt; + cur_info->prev_wpt = (waypoint*)wpt; cur_info->count++; routepoints++; } @@ -257,7 +257,7 @@ prework_wpt_cb(const waypoint *wpt) /* output helpers */ static void -print_position(const waypoint *wpt) +print_position(const waypoint* wpt) { int valid = 1; double lat, lon, north, east; @@ -375,7 +375,7 @@ static void print_categories(gbuint16 categories) { int i, count; - char *c; + char* c; if (categories == 0) { return; @@ -407,7 +407,7 @@ print_categories(gbuint16 categories) } static void -print_course(const waypoint *A, const waypoint *B) /* seems to be okay */ +print_course(const waypoint* A, const waypoint* B) /* seems to be okay */ { if ((A != NULL) && (B != NULL) && (A != B)) { int course; @@ -452,11 +452,11 @@ print_distance(const double distance, const int no_scale, const int with_tab, co } static void -print_speed(double *distance, time_t *time) +print_speed(double* distance, time_t* time) { int idist; double dist = *distance; - char *unit; + char* unit; if (!gtxt_flags.metric) { dist = METERS_TO_MILES(dist) * 1000.0; @@ -494,10 +494,10 @@ print_temperature(const float temperature) } static void -print_string(const char *fmt, const char *string) +print_string(const char* fmt, const char* string) { - char *c; - char *buff; + char* c; + char* buff; buff = xstrdup(string); /* remove unwanted characters from source string */ @@ -514,16 +514,16 @@ print_string(const char *fmt, const char *string) /* main cb's */ static void -write_waypt(const waypoint *wpt) +write_waypt(const waypoint* wpt) { unsigned char wpt_class; garmin_fs_p gmsd; - char *wpt_type; - char *dspl_mode; - const char *country; + char* wpt_type; + char* dspl_mode; + const char* country; double x; int i, icon, dynamic; - char *icon_descr; + char* icon_descr; gmsd = GMSD_FIND(wpt); @@ -542,7 +542,7 @@ write_waypt(const waypoint *wpt) gbfprintf(fout, "Waypoint\t%s\t", (wpt->shortname) ? wpt->shortname : ""); if (wpt_class <= gt_waypt_class_airport_ndb) { - char *temp = wpt->notes; + char* temp = wpt->notes; if (temp == NULL) { if (wpt->description && (strcmp(wpt->description, wpt->shortname) != 0)) { temp = wpt->description; @@ -606,9 +606,9 @@ write_waypt(const waypoint *wpt) } static void -route_disp_hdr_cb(const route_head *rte) +route_disp_hdr_cb(const route_head* rte) { - current_trk = (route_head *)rte; + current_trk = (route_head*)rte; cur_info = &route_info[route_idx]; cur_info->prev_wpt = NULL; cur_info->total = 0; @@ -630,15 +630,15 @@ route_disp_hdr_cb(const route_head *rte) } static void -route_disp_tlr_cb(const route_head *rte) +route_disp_tlr_cb(const route_head* rte) { route_idx++; } static void -route_disp_wpt_cb(const waypoint *wpt) +route_disp_wpt_cb(const waypoint* wpt) { - waypoint *prev = cur_info->prev_wpt; + waypoint* prev = cur_info->prev_wpt; gbfprintf(fout, "Route Waypoint\t"); gbfprintf(fout, "%s\t", wpt->shortname); @@ -655,16 +655,16 @@ route_disp_wpt_cb(const waypoint *wpt) gbfprintf(fout, "\r\n"); - cur_info->prev_wpt = (waypoint *)wpt; + cur_info->prev_wpt = (waypoint*)wpt; } static void -track_disp_hdr_cb(const route_head *track) +track_disp_hdr_cb(const route_head* track) { cur_info = &route_info[route_idx]; cur_info->prev_wpt = NULL; cur_info->total = 0; - current_trk = (route_head *)track; + current_trk = (route_head*)track; if (track->rte_waypt_ct <= 0) { return; } @@ -684,15 +684,15 @@ track_disp_hdr_cb(const route_head *track) } static void -track_disp_tlr_cb(const route_head *track) +track_disp_tlr_cb(const route_head* track) { route_idx++; } static void -track_disp_wpt_cb(const waypoint *wpt) +track_disp_wpt_cb(const waypoint* wpt) { - waypoint *prev = cur_info->prev_wpt; + waypoint* prev = cur_info->prev_wpt; time_t delta; double dist, depth; @@ -727,7 +727,7 @@ track_disp_wpt_cb(const waypoint *wpt) } gbfprintf(fout, "\r\n"); - cur_info->prev_wpt = (waypoint *)wpt; + cur_info->prev_wpt = (waypoint*)wpt; } /******************************************************************************* @@ -735,9 +735,9 @@ track_disp_wpt_cb(const waypoint *wpt) *******************************************************************************/ static void -garmin_txt_wr_init(const char *fname) +garmin_txt_wr_init(const char* fname) { - char *grid_str; + char* grid_str; memset(>xt_flags, 0, sizeof(gtxt_flags)); @@ -800,8 +800,8 @@ garmin_txt_wr_deinit(void) static void garmin_txt_write(void) { - char *grid_str, *c; - const char *datum_str; + char* grid_str, *c; + const char* datum_str; grid_str = xstrdup(gt_get_mps_grid_longname(grid_index, MYNAME)); while ((c = strchr(grid_str, '*'))) { @@ -823,14 +823,14 @@ garmin_txt_write(void) int i; wpt_a_ct = 0; - wpt_a = (waypoint **)xcalloc(waypoints, sizeof(*wpt_a)); + wpt_a = (waypoint**)xcalloc(waypoints, sizeof(*wpt_a)); waypt_disp_all(enum_waypt_cb); route_disp_all(NULL, NULL, enum_waypt_cb); qsort(wpt_a, waypoints, sizeof(*wpt_a), sort_waypt_cb); gbfprintf(fout, "Header\t%s\r\n\r\n", headers[waypt_header]); for (i = 0; i < waypoints; i++) { - waypoint *wpt = wpt_a[i]; + waypoint* wpt = wpt_a[i]; write_waypt(wpt); } xfree(wpt_a); @@ -868,7 +868,7 @@ free_header(const header_type ht) int i; for (i = 0; i < MAX_HEADER_FIELDS; i++) { - char *c = header_lines[ht][i]; + char* c = header_lines[ht][i]; if (c != NULL) { xfree(c); header_lines[ht][i] = NULL; @@ -881,10 +881,10 @@ free_header(const header_type ht) /* data parsers */ static int -parse_date_and_time(char *str, time_t *value) +parse_date_and_time(char* str, time_t* value) { struct tm tm; - char *cerr, *cin; + char* cerr, *cin; memset(&tm, 0, sizeof(tm)); cin = lrtrim(str); @@ -906,12 +906,12 @@ parse_date_and_time(char *str, time_t *value) } static gbuint16 -parse_categories(const char *str) +parse_categories(const char* str) { char buff[256]; gbuint16 val; gbuint16 res = 0; - char *cin, *cx; + char* cin, *cx; if (*str == '\0') { return 0; @@ -941,7 +941,7 @@ parse_categories(const char *str) } static int -parse_temperature(const char *str, double *temperature) +parse_temperature(const char* str, double* temperature) { double value; unsigned char unit; @@ -972,7 +972,7 @@ parse_temperature(const char *str, double *temperature) static void parse_header(void) { - char *str; + char* str; int column = -1; free_header(unknown_header); @@ -987,7 +987,7 @@ parse_header(void) } static int -parse_display(const char *str, int *val) +parse_display(const char* str, int* val) { gt_display_modes_e i; @@ -1009,7 +1009,7 @@ static void bind_fields(const header_type ht) { int i; - char *fields, *c; + char* fields, *c; is_fatal((grid_index < 0) || (datum_index < 0), MYNAME ": Incomplete or invalid file header!"); @@ -1030,7 +1030,7 @@ bind_fields(const header_type ht) } for (i = 0; i < header_ct[unknown_header]; i++) { - char *name; + char* name; int field_no; name = header_lines[ht][i] = header_lines[unknown_header][i]; header_lines[unknown_header][i] = NULL; @@ -1056,7 +1056,7 @@ bind_fields(const header_type ht) static void parse_grid(void) { - char *str = csv_lineparse(NULL, "\t", "", 1); + char* str = csv_lineparse(NULL, "\t", "", 1); if (str != NULL) { if (strstr(str, "dd.ddddd") != 0) { @@ -1076,7 +1076,7 @@ parse_grid(void) static void parse_datum(void) { - char *str = csv_lineparse(NULL, "\t", "", 1); + char* str = csv_lineparse(NULL, "\t", "", 1); if (str != NULL) { datum_index = gt_lookup_datum_index(str, MYNAME); @@ -1088,16 +1088,16 @@ parse_datum(void) static void parse_waypoint(void) { - char *str; + char* str; int column = -1; - waypoint *wpt; + waypoint* wpt; garmin_fs_p gmsd = NULL; bind_fields(waypt_header); wpt = waypt_new(); gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); while ((str = csv_lineparse(NULL, "\t", "", column++))) { int i, dynamic; @@ -1188,9 +1188,9 @@ parse_waypoint(void) static void parse_route_header(void) { - char *str; + char* str; int column = -1; - route_head *rte; + route_head* rte; rte = route_head_alloc(); @@ -1213,9 +1213,9 @@ parse_route_header(void) static void parse_track_header(void) { - char *str; + char* str; int column = -1; - route_head *trk; + route_head* trk; bind_fields(track_header); trk = route_head_alloc(); @@ -1237,9 +1237,9 @@ parse_track_header(void) static void parse_route_waypoint(void) { - char *str; + char* str; int column = -1; - waypoint *wpt = NULL; + waypoint* wpt = NULL; bind_fields(rtept_header); @@ -1262,9 +1262,9 @@ parse_route_waypoint(void) static void parse_track_waypoint(void) { - char *str; + char* str; int column = -1; - waypoint *wpt; + waypoint* wpt; bind_fields(trkpt_header); wpt = waypt_new(); @@ -1317,7 +1317,7 @@ parse_track_waypoint(void) /***************************************************************/ static void -garmin_txt_rd_init(const char *fname) +garmin_txt_rd_init(const char* fname) { memset(>xt_flags, 0, sizeof(gtxt_flags)); @@ -1345,12 +1345,12 @@ garmin_txt_rd_deinit(void) static void garmin_txt_read(void) { - char *buff; + char* buff; current_line = 0; while ((buff = gbfgetstr(fin))) { - char *cin; + char* cin; if ((current_line++ == 0) && fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); diff --git a/gpsbabel/garmin_xt.c b/gpsbabel/garmin_xt.c index 716010edf..38fedfa04 100644 --- a/gpsbabel/garmin_xt.c +++ b/gpsbabel/garmin_xt.c @@ -50,10 +50,10 @@ static int colors[] = { 0xffffff // White }; -static gbfile *fin; -static route_head *track; -static char *opt_xt_ftype = NULL; -static char *opt_trk_header = NULL; +static gbfile* fin; +static route_head* track; +static char* opt_xt_ftype = NULL; +static char* opt_trk_header = NULL; static arglist_t format_garmin_xt_args[] = { @@ -72,7 +72,7 @@ arglist_t format_garmin_xt_args[] = { * %%% Reader callbacks %%% * *******************************************************************************/ static void -format_garmin_xt_rd_init(const char *fname) +format_garmin_xt_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); } @@ -84,7 +84,7 @@ format_garmin_xt_rd_deinit(void) } static gbuint16 -format_garmin_xt_rd_st_attrs(char *p_trk_name, gbuint8 *p_track_color) +format_garmin_xt_rd_st_attrs(char* p_trk_name, gbuint8* p_track_color) { int method = 0; gbuint16 trackbytes = 0, TrackPoints = 0; @@ -168,7 +168,7 @@ format_garmin_xt_decrypt_trk_blk(int Count, gbuint8 TrackBlock[]) * Function to Decompose track block of STRK_BLOCK_SIZE bytes */ static void -format_garmin_xt_decomp_trk_blk(gbuint8 ii, gbuint8 TrackBlock[], double *Ele, double *Lat, double *Lon, gbuint32 *Time) +format_garmin_xt_decomp_trk_blk(gbuint8 ii, gbuint8 TrackBlock[], double* Ele, double* Lat, double* Lon, gbuint32* Time) { gbuint32 LatLW = 0, LonLW = 0, TimeLW = 0; double LatF = 0, LonF = 0; @@ -216,7 +216,7 @@ format_garmin_xt_decomp_trk_blk(gbuint8 ii, gbuint8 TrackBlock[], double *Ele, d * Decompose Last Waypoint Eleveation */ static void -format_garmin_xt_decomp_last_ele(gbuint8 ii, double *PrevEle, gbuint8 TrackBlock[]) +format_garmin_xt_decomp_last_ele(gbuint8 ii, double* PrevEle, gbuint8 TrackBlock[]) { gbuint16 PrevEleW; @@ -254,10 +254,10 @@ format_garmin_xt_proc_strk(void) // Process all tracks one by one while ((TracksCompleted < NumberOfTracks) && (!gbfeof(fin))) { - route_head *tmp_track; - waypoint *wpt; - char *trk_name; - trk_name = xmalloc(30); + route_head* tmp_track; + waypoint* wpt; + char* trk_name; + trk_name = (char*) xmalloc(30); // Generate Track Header trackbytes = format_garmin_xt_rd_st_attrs(trk_name, &trk_color) - 50; @@ -341,7 +341,7 @@ format_garmin_xt_proc_atrk(void) gbuint32 Lat=0, Lon=0; gbuint32 Tim=0; double LatF = 0, LonF = 0, AltF = 0; - waypoint *wpt; + waypoint* wpt; int method = 0; unsigned char buf[3]; gbint32 num_trackpoints; diff --git a/gpsbabel/gbfile.c b/gpsbabel/gbfile.c index 2fd835e5b..c54133640 100644 --- a/gpsbabel/gbfile.c +++ b/gpsbabel/gbfile.c @@ -62,8 +62,8 @@ /* %%% Zlib file api %%% */ /*******************************************************************************/ -static gbfile * -gzapi_open(gbfile *self, const char *mode) +static gbfile* +gzapi_open(gbfile* self, const char* mode) { char openmode[32]; @@ -77,16 +77,16 @@ gzapi_open(gbfile *self, const char *mode) } if (self->is_pipe) { - FILE *fd; + FILE* fd; if (self->mode == 'r') { fd = stdin; } else { fd = stdout; } SET_BINARY_MODE(fd); - self->handle.gz = (void **)gzdopen(fileno(fd), openmode); + self->handle.gz = (void**)gzdopen(fileno(fd), openmode); } else { - self->handle.gz = (void **)gzopen(self->name, openmode); + self->handle.gz = (void**)gzopen(self->name, openmode); } if (self->handle.gz == NULL) { @@ -100,13 +100,13 @@ gzapi_open(gbfile *self, const char *mode) } static int -gzapi_close(gbfile *self) +gzapi_close(gbfile* self) { return gzclose(self->handle.gz); } static int -gzapi_seek(gbfile *self, gbint32 offset, int whence) +gzapi_seek(gbfile* self, gbint32 offset, int whence) { int result; @@ -128,10 +128,10 @@ gzapi_seek(gbfile *self, gbint32 offset, int whence) } static gbsize_t -gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +gzapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { int result = 0; - char *target = (char*) buf; + char* target = (char*) buf; int count = size * members; if (self->back != -1) { @@ -151,7 +151,7 @@ gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) if ((result < 0) || ((gbsize_t)result < members)) { int errnum; - const char *errtxt; + const char* errtxt; errtxt = gzerror(self->handle.gz, &errnum); @@ -167,19 +167,19 @@ gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) } static gbsize_t -gzapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +gzapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { return gzwrite(self->handle.gz, buf, size * members) / size; } static int -gzapi_flush(gbfile *self) +gzapi_flush(gbfile* self) { return gzflush(self->handle.gz, Z_SYNC_FLUSH); } static gbsize_t -gzapi_tell(gbfile *self) +gzapi_tell(gbfile* self) { gbsize_t result; @@ -192,7 +192,7 @@ gzapi_tell(gbfile *self) } static int -gzapi_eof(gbfile *self) +gzapi_eof(gbfile* self) { int res = 0; @@ -220,7 +220,7 @@ gzapi_eof(gbfile *self) } static int -gzapi_ungetc(const int c, gbfile *self) +gzapi_ungetc(const int c, gbfile* self) { if (self->back == -1) { self->back = c; @@ -231,13 +231,13 @@ gzapi_ungetc(const int c, gbfile *self) } static void -gzapi_clearerr(gbfile *self) +gzapi_clearerr(gbfile* self) { gzclearerr(self->handle.gz); } static int -gzapi_error(gbfile *self) +gzapi_error(gbfile* self) { int errnum; @@ -252,21 +252,21 @@ gzapi_error(gbfile *self) /* %%% Standard C file api %%% */ /*******************************************************************************/ -static gbfile * -stdapi_open(gbfile *self, const char *mode) +static gbfile* +stdapi_open(gbfile* self, const char* mode) { self->handle.std = xfopen(self->name, mode, self->module); return self; } static int -stdapi_close(gbfile *self) +stdapi_close(gbfile* self) { return fclose(self->handle.std); } static int -stdapi_seek(gbfile *self, gbint32 offset, int whence) +stdapi_seek(gbfile* self, gbint32 offset, int whence) { int result; gbsize_t pos = 0; @@ -296,7 +296,7 @@ stdapi_seek(gbfile *self, gbint32 offset, int whence) } static gbsize_t -stdapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +stdapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { int errno; gbsize_t result = fread(buf, size, members, self->handle.std); @@ -309,43 +309,43 @@ stdapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self } static gbsize_t -stdapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +stdapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { return fwrite(buf, size, members, self->handle.std); } static int -stdapi_flush(gbfile *self) +stdapi_flush(gbfile* self) { return fflush(self->handle.std); } static gbsize_t -stdapi_tell(gbfile *self) +stdapi_tell(gbfile* self) { return ftell(self->handle.std); } static int -stdapi_eof(gbfile *self) +stdapi_eof(gbfile* self) { return feof(self->handle.std); } static int -stdapi_ungetc(const int c, gbfile *self) +stdapi_ungetc(const int c, gbfile* self) { return ungetc(c, self->handle.std); } static void -stdapi_clearerr(gbfile *self) +stdapi_clearerr(gbfile* self) { clearerr(self->handle.std); } static int -stdapi_error(gbfile *self) +stdapi_error(gbfile* self) { return ferror(self->handle.std); } @@ -355,8 +355,8 @@ stdapi_error(gbfile *self) /* %%% Memory stream (memapi) %%% */ /*******************************************************************************/ -static gbfile * -memapi_open(gbfile *self, const char *mode) +static gbfile* +memapi_open(gbfile* self, const char* mode) { self->mempos = 0; self->memsz = 0; @@ -366,7 +366,7 @@ memapi_open(gbfile *self, const char *mode) } static int -memapi_close(gbfile *self) +memapi_close(gbfile* self) { if (self->handle.mem) { xfree(self->handle.mem); @@ -376,7 +376,7 @@ memapi_close(gbfile *self) } static int -memapi_seek(gbfile *self, gbint32 offset, int whence) +memapi_seek(gbfile* self, gbint32 offset, int whence) { long long pos = (int)self->mempos; @@ -399,7 +399,7 @@ memapi_seek(gbfile *self, gbint32 offset, int whence) } static gbsize_t -memapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +memapi_read(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { gbsize_t count; gbsize_t result = (self->memlen - self->mempos) / size; @@ -417,7 +417,7 @@ memapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self } static gbsize_t -memapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self) +memapi_write(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self) { gbsize_t count; @@ -442,25 +442,25 @@ memapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfil } static int -memapi_flush(gbfile *self) +memapi_flush(gbfile* self) { return 0; } static gbsize_t -memapi_tell(gbfile *self) +memapi_tell(gbfile* self) { return self->mempos; } static int -memapi_eof(gbfile *self) +memapi_eof(gbfile* self) { return (self->mempos == self->memlen); } static int -memapi_ungetc(const int c, gbfile *self) +memapi_ungetc(const int c, gbfile* self) { if (self->mempos == 0) { return EOF; @@ -472,13 +472,13 @@ memapi_ungetc(const int c, gbfile *self) } static void -memapi_clearerr(gbfile *self) +memapi_clearerr(gbfile* self) { return; } static int -memapi_error(gbfile *self) +memapi_error(gbfile* self) { return 0; } @@ -490,11 +490,11 @@ memapi_error(gbfile *self) * gbfopen: (as xfopen) plus the name of the calling GPSBabel module (MYNAME) */ -gbfile * -gbfopen(const char *filename, const char *mode, const char *module) +gbfile* +gbfopen(const char* filename, const char* mode, const char* module) { - gbfile *file; - const char *m; + gbfile* file; + const char* m; int len; file = (gbfile*) xcalloc(1, sizeof(*file)); @@ -589,7 +589,7 @@ gbfopen(const char *filename, const char *mode, const char *module) #else file->buffsz = 256; #endif - file->buff = (char *) xmalloc(file->buffsz); + file->buff = (char*) xmalloc(file->buffsz); return file; } @@ -598,10 +598,10 @@ gbfopen(const char *filename, const char *mode, const char *module) * gbfopen_be: as gbfopen, but set the BIG-ENDIAN flag */ -gbfile * -gbfopen_be(const char *filename, const char *mode, const char *module) +gbfile* +gbfopen_be(const char* filename, const char* mode, const char* module) { - gbfile *result; + gbfile* result; result = gbfopen(filename, mode, module); result->big_endian = 1; @@ -614,7 +614,7 @@ gbfopen_be(const char *filename, const char *mode, const char *module) */ void -gbfclose(gbfile *file) +gbfclose(gbfile* file) { if (!file) { return; @@ -633,7 +633,7 @@ gbfclose(gbfile *file) */ int -gbfgetc(gbfile *file) +gbfgetc(gbfile* file) { unsigned char c; @@ -649,10 +649,10 @@ gbfgetc(gbfile *file) * gbfgets: (as fgets) */ -char * -gbfgets(char *buf, int len, gbfile *file) +char* +gbfgets(char* buf, int len, gbfile* file) { - char *result = buf; + char* result = buf; while (--len > 0) { int c = gbfgetc(file); @@ -661,7 +661,7 @@ gbfgets(char *buf, int len, gbfile *file) break; } - *(unsigned char *)buf = (unsigned char)c; + *(unsigned char*)buf = (unsigned char)c; buf++; if (c == '\r') { @@ -683,7 +683,7 @@ gbfgets(char *buf, int len, gbfile *file) */ gbsize_t -gbfread(void *buf, const gbsize_t size, const gbsize_t members, gbfile *file) +gbfread(void* buf, const gbsize_t size, const gbsize_t members, gbfile* file) { if ((size == 0) || (members == 0)) { return 0; @@ -695,7 +695,7 @@ gbfread(void *buf, const gbsize_t size, const gbsize_t members, gbfile *file) * gbvfprintf: (as vfprintf) */ -int gbvfprintf(gbfile *file, const char *format, va_list ap) +int gbvfprintf(gbfile* file, const char* format, va_list ap) { int len; @@ -738,7 +738,7 @@ int gbvfprintf(gbfile *file, const char *format, va_list ap) */ int -gbfprintf(gbfile *file, const char *format, ...) +gbfprintf(gbfile* file, const char* format, ...) { va_list args; int result; @@ -755,7 +755,7 @@ gbfprintf(gbfile *file, const char *format, ...) */ int -gbfputc(int c, gbfile *file) +gbfputc(int c, gbfile* file) { unsigned char temp = (unsigned int) c; @@ -769,7 +769,7 @@ gbfputc(int c, gbfile *file) */ int -gbfputs(const char *s, gbfile *file) +gbfputs(const char* s, gbfile* file) { return gbfwrite(s, 1, strlen(s), file); } @@ -779,7 +779,7 @@ gbfputs(const char *s, gbfile *file) */ int -gbfwrite(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *file) +gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file) { int result; @@ -800,7 +800,7 @@ gbfwrite(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *f */ int -gbfflush(gbfile *file) +gbfflush(gbfile* file) { return file->fileflush(file); } @@ -810,7 +810,7 @@ gbfflush(gbfile *file) */ void -gbfclearerr(gbfile *file) +gbfclearerr(gbfile* file) { file->fileclearerr(file); } @@ -820,7 +820,7 @@ gbfclearerr(gbfile *file) */ int -gbferror(gbfile *file) +gbferror(gbfile* file) { return file->fileerror(file); } @@ -830,7 +830,7 @@ gbferror(gbfile *file) */ void -gbfrewind(gbfile *file) +gbfrewind(gbfile* file) { (void) gbfseek(file, 0, SEEK_SET); gbfclearerr(file); @@ -841,7 +841,7 @@ gbfrewind(gbfile *file) */ int -gbfseek(gbfile *file, gbint32 offset, int whence) +gbfseek(gbfile* file, gbint32 offset, int whence) { return file->fileseek(file, offset, whence); } @@ -851,7 +851,7 @@ gbfseek(gbfile *file, gbint32 offset, int whence) */ gbsize_t -gbftell(gbfile *file) +gbftell(gbfile* file) { gbsize_t result = file->filetell(file); if ((signed) result == -1) @@ -865,7 +865,7 @@ gbftell(gbfile *file) */ int -gbfeof(gbfile *file) +gbfeof(gbfile* file) { return file->fileeof(file); } @@ -875,7 +875,7 @@ gbfeof(gbfile *file) */ int -gbfungetc(const int c, gbfile *file) +gbfungetc(const int c, gbfile* file) { return file->fileungetc(c, file); } @@ -887,7 +887,7 @@ gbfungetc(const int c, gbfile *file) */ gbint32 -gbfgetint32(gbfile *file) +gbfgetint32(gbfile* file) { char buf[4]; @@ -906,7 +906,7 @@ gbfgetint32(gbfile *file) */ gbint16 -gbfgetint16(gbfile *file) +gbfgetint16(gbfile* file) { char buf[2]; @@ -925,7 +925,7 @@ gbfgetint16(gbfile *file) */ double -gbfgetdbl(gbfile *file) +gbfgetdbl(gbfile* file) { char buf[8]; @@ -940,7 +940,7 @@ gbfgetdbl(gbfile *file) */ float -gbfgetflt(gbfile *file) +gbfgetflt(gbfile* file) { char buf[4]; @@ -955,12 +955,12 @@ gbfgetflt(gbfile *file) * The result is a temporary allocated entity: use it or free it! */ -char * -gbfgetcstr(gbfile *file) +char* +gbfgetcstr(gbfile* file) { - char *result; + char* result; int len = 0; - char *str = file->buff; + char* str = file->buff; for (;;) { int c = gbfgetc(file); @@ -977,7 +977,7 @@ gbfgetcstr(gbfile *file) len++; } - result = (char *) xmalloc(len + 1); + result = (char*) xmalloc(len + 1); if (len > 0) { memcpy(result, str, len); } @@ -991,14 +991,14 @@ gbfgetcstr(gbfile *file) * The result is a temporary allocated entity: use it or free it! */ -char * -gbfgetpstr(gbfile *file) +char* +gbfgetpstr(gbfile* file) { int len; - char *result; + char* result; len = gbfgetc(file); - result = (char *) xmalloc(len + 1); + result = (char*) xmalloc(len + 1); if (len > 0) { gbfread(result, 1, len, file); } @@ -1007,11 +1007,11 @@ gbfgetpstr(gbfile *file) return result; } -static char * -gbfgetucs2str(gbfile *file) +static char* +gbfgetucs2str(gbfile* file) { int len = 0; - char *result = file->buff; + char* result = file->buff; for (;;) { char buff[8]; @@ -1076,11 +1076,11 @@ gbfgetucs2str(gbfile *file) * except xfree and free you can do all possible things with the result */ -char * -gbfgetstr(gbfile *file) +char* +gbfgetstr(gbfile* file) { int len = 0; - char *result = file->buff; + char* result = file->buff; if (file->unicode) { return gbfgetucs2str(file); @@ -1140,7 +1140,7 @@ gbfgetstr(gbfile *file) */ int -gbfputint16(const gbint16 i, gbfile *file) +gbfputint16(const gbint16 i, gbfile* file) { char buf[2]; @@ -1157,7 +1157,7 @@ gbfputint16(const gbint16 i, gbfile *file) */ int -gbfputint32(const gbint32 i, gbfile *file) +gbfputint32(const gbint32 i, gbfile* file) { char buf[4]; @@ -1174,7 +1174,7 @@ gbfputint32(const gbint32 i, gbfile *file) */ int -gbfputdbl(const double d, gbfile *file) +gbfputdbl(const double d, gbfile* file) { char buf[8]; @@ -1187,7 +1187,7 @@ gbfputdbl(const double d, gbfile *file) */ int -gbfputflt(const float f, gbfile *file) +gbfputflt(const float f, gbfile* file) { char buf[4]; @@ -1201,7 +1201,7 @@ gbfputflt(const float f, gbfile *file) */ int -gbfputcstr(const char *s, gbfile *file) +gbfputcstr(const char* s, gbfile* file) { int len; @@ -1220,7 +1220,7 @@ gbfputcstr(const char *s, gbfile *file) */ int -gbfputpstr(const char *s, gbfile *file) +gbfputpstr(const char* s, gbfile* file) { int len; @@ -1238,7 +1238,7 @@ gbfputpstr(const char *s, gbfile *file) /* Much more higher level functions */ gbsize_t -gbfcopyfrom(gbfile *file, gbfile *src, gbsize_t count) +gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count) { char buf[1024]; gbsize_t copied = 0; diff --git a/gpsbabel/gbfile.h b/gpsbabel/gbfile.h index 2f09a4f9d..4bb73c45e 100644 --- a/gpsbabel/gbfile.h +++ b/gpsbabel/gbfile.h @@ -32,32 +32,32 @@ struct gbfile_s; typedef struct gbfile_s gbfile; -typedef void (*gbfclearerr_cb)(gbfile *self); -typedef int (*gbfclose_cb)(gbfile *self); -typedef int (*gbfeof_cb)(gbfile *self); -typedef int (*gbferror_cb)(gbfile *self); -typedef int (*gbfflush_cb)(gbfile *self); -typedef gbfile* (*gbfopen_cb)(gbfile *self, const char *mode); -typedef gbsize_t (*gbfread_cb)(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self); -typedef int (*gbfseek_cb)(gbfile *self, gbint32 offset, int whence); -typedef gbsize_t (*gbftell_cb)(gbfile *self); -typedef gbsize_t (*gbfwrite_cb)(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *self); -typedef int (*gbfungetc_cb)(const int c, gbfile *self); +typedef void (*gbfclearerr_cb)(gbfile* self); +typedef int (*gbfclose_cb)(gbfile* self); +typedef int (*gbfeof_cb)(gbfile* self); +typedef int (*gbferror_cb)(gbfile* self); +typedef int (*gbfflush_cb)(gbfile* self); +typedef gbfile* (*gbfopen_cb)(gbfile* self, const char* mode); +typedef gbsize_t (*gbfread_cb)(void* buf, const gbsize_t size, const gbsize_t members, gbfile* self); +typedef int (*gbfseek_cb)(gbfile* self, gbint32 offset, int whence); +typedef gbsize_t (*gbftell_cb)(gbfile* self); +typedef gbsize_t (*gbfwrite_cb)(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* self); +typedef int (*gbfungetc_cb)(const int c, gbfile* self); typedef struct gbfile_s { #ifdef DEBUG_MEM - void *dummy; /* ZERO pointer for stdio oop's */ + void* dummy; /* ZERO pointer for stdio oop's */ #endif union { - FILE *std; - unsigned char *mem; + FILE* std; + unsigned char* mem; #if !ZLIB_INHIBITED - gzFile *gz; + gzFile* gz; #endif } handle; - char *name; - char *module; - char *buff; /* static growing buffer, primary used by gbprintf */ + char* name; + char* module; + char* buff; /* static growing buffer, primary used by gbprintf */ int buffsz; char mode; int back; @@ -85,50 +85,50 @@ typedef struct gbfile_s { } gbfile_t; -gbfile *gbfopen(const char *filename, const char *mode, const char *module); -gbfile *gbfopen_be(const char *filename, const char *mode, const char *module); +gbfile* gbfopen(const char* filename, const char* mode, const char* module); +gbfile* gbfopen_be(const char* filename, const char* mode, const char* module); #define gbfopen_le gbfopen -void gbfclose(gbfile *file); - -gbsize_t gbfread(void *buf, const gbsize_t size, const gbsize_t members, gbfile *file); -int gbfgetc(gbfile *file); -char *gbfgets(char *buf, int len, gbfile *file); - -int gbvfprintf(gbfile *file, const char *format, va_list ap); -int gbfprintf(gbfile *file, const char *format, ...); -int gbfputc(int c, gbfile *file); -int gbfputs(const char *s, gbfile *file); -int gbfwrite(const void *buf, const gbsize_t size, const gbsize_t members, gbfile *file); -int gbfflush(gbfile *file); - -void gbfclearerr(gbfile *file); -int gbferror(gbfile *file); -void gbfrewind(gbfile *file); -int gbfseek(gbfile *file, gbint32 offset, int whence); -gbsize_t gbftell(gbfile *file); -int gbfeof(gbfile *file); -int gbfungetc(const int c, gbfile *file); - -gbint32 gbfgetint32(gbfile *file); +void gbfclose(gbfile* file); + +gbsize_t gbfread(void* buf, const gbsize_t size, const gbsize_t members, gbfile* file); +int gbfgetc(gbfile* file); +char* gbfgets(char* buf, int len, gbfile* file); + +int gbvfprintf(gbfile* file, const char* format, va_list ap); +int gbfprintf(gbfile* file, const char* format, ...); +int gbfputc(int c, gbfile* file); +int gbfputs(const char* s, gbfile* file); +int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file); +int gbfflush(gbfile* file); + +void gbfclearerr(gbfile* file); +int gbferror(gbfile* file); +void gbfrewind(gbfile* file); +int gbfseek(gbfile* file, gbint32 offset, int whence); +gbsize_t gbftell(gbfile* file); +int gbfeof(gbfile* file); +int gbfungetc(const int c, gbfile* file); + +gbint32 gbfgetint32(gbfile* file); #define gbfgetuint32 (gbuint32)gbfgetint32 -gbint16 gbfgetint16(gbfile *file); +gbint16 gbfgetint16(gbfile* file); #define gbfgetuint16 (gbuint16)gbfgetint16 -double gbfgetdbl(gbfile *file); // read a double value -float gbfgetflt(gbfile *file); // read a float value -char *gbfgetstr(gbfile *file); // read until any type of line-breaks or EOF -char *gbfgetpstr(gbfile *file); // read a pascal string -char *gbfgetcstr(gbfile *file); // read a null terminated string +double gbfgetdbl(gbfile* file); // read a double value +float gbfgetflt(gbfile* file); // read a float value +char* gbfgetstr(gbfile* file); // read until any type of line-breaks or EOF +char* gbfgetpstr(gbfile* file); // read a pascal string +char* gbfgetcstr(gbfile* file); // read a null terminated string -int gbfputint16(const gbint16 i, gbfile *file); +int gbfputint16(const gbint16 i, gbfile* file); #define gbfputuint16(a,b) gbfputint16((gbuint16)(a),(b)) -int gbfputint32(const gbint32 i, gbfile *file); +int gbfputint32(const gbint32 i, gbfile* file); #define gbfputuint32(a,b) gbfputint32((gbuint32)(a),(b)) -int gbfputdbl(const double d, gbfile *file); // write a double value -int gbfputflt(const float f, gbfile *file); // write a float value -int gbfputcstr(const char *s, gbfile *file); // write string including '\0' -int gbfputpstr(const char *s, gbfile *file); // write as pascal string +int gbfputdbl(const double d, gbfile* file); // write a double value +int gbfputflt(const float f, gbfile* file); // write a float value +int gbfputcstr(const char* s, gbfile* file); // write string including '\0' +int gbfputpstr(const char* s, gbfile* file); // write as pascal string -gbsize_t gbfcopyfrom(gbfile *file, gbfile *src, gbsize_t count); +gbsize_t gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count); #endif diff --git a/gpsbabel/gbser.c b/gpsbabel/gbser.c index deefa09aa..9cb2fc9a9 100644 --- a/gpsbabel/gbser.c +++ b/gpsbabel/gbser.c @@ -26,7 +26,7 @@ #include #include -void gbser__db(int l, const char *msg, ...) +void gbser__db(int l, const char* msg, ...) { va_list ap; va_start(ap, msg); @@ -38,7 +38,7 @@ void gbser__db(int l, const char *msg, ...) /* Set the serial port speed. */ -int gbser_set_speed(void *handle, unsigned speed) +int gbser_set_speed(void* handle, unsigned speed) { return gbser_set_port(handle, speed, 8, 0, 1); } @@ -65,7 +65,7 @@ static int parity_letter(char c) * insensitive, spaces are allowed around the commas and omitted * trailing fields will default to '8', 'N' and '1' */ -int gbser_setup(void *handle, const char *spec) +int gbser_setup(void* handle, const char* spec) { unsigned arg[] = { 4800, 8, 0, 1 }; int ap; @@ -107,7 +107,7 @@ int gbser_setup(void *handle, const char *spec) /* Return true if there are characters available on the serial port */ -int gbser_avail(void *handle) +int gbser_avail(void* handle) { return gbser__fill_buffer(handle, 1, NULL); } @@ -116,7 +116,7 @@ int gbser_avail(void *handle) * bytes will be read. Returns the number of bytes read or gbser_ERROR if an * error occurs. */ -int gbser_read(void *handle, void *buf, unsigned len) +int gbser_read(void* handle, void* buf, unsigned len) { int got = 0; @@ -138,7 +138,7 @@ int gbser_read(void *handle, void *buf, unsigned len) /* Read the specified number of bytes. Block until the requested number * of bytes have been read or the timeout (in ms) is exceeded. */ -int gbser_read_wait(void *handle, void *buf, unsigned len, unsigned ms) +int gbser_read_wait(void* handle, void* buf, unsigned len, unsigned ms) { int got = 0; @@ -156,7 +156,7 @@ int gbser_read_wait(void *handle, void *buf, unsigned len, unsigned ms) /* Read a single character from the port, returning immediately if * none are available. */ -int gbser_readc(void *handle) +int gbser_readc(void* handle) { unsigned char buf; int rc; @@ -174,7 +174,7 @@ int gbser_readc(void *handle) /* Read a single character from the port, waiting up to |ms| * milliseconds for a character to be available. */ -int gbser_readc_wait(void *handle, unsigned ms) +int gbser_readc_wait(void* handle, unsigned ms) { unsigned char buf; int rc; @@ -192,14 +192,14 @@ int gbser_readc_wait(void *handle, unsigned ms) /* Write a null terminated string in |str| to the serial * port. */ -int gbser_print(void *handle, const char *str) +int gbser_print(void* handle, const char* str) { return gbser_write(handle, str, (unsigned) strlen(str)); } /* Write a single character to the serial port. */ -int gbser_writec(void *handle, int c) +int gbser_writec(void* handle, int c) { return gbser_write(handle, &c, 1); } diff --git a/gpsbabel/gbser.h b/gpsbabel/gbser.h index 415afb69a..55e53eb23 100644 --- a/gpsbabel/gbser.h +++ b/gpsbabel/gbser.h @@ -38,18 +38,18 @@ * ('com1:') are translated into the equivalent name required by * WIN32 */ -void *gbser_init(const char *port_name); +void* gbser_init(const char* port_name); /* Close a serial port */ -void gbser_deinit(void *handle); +void gbser_deinit(void* handle); /* Set the serial port speed. */ -int gbser_set_speed(void *handle, unsigned speed); +int gbser_set_speed(void* handle, unsigned speed); /* Set the serial port speed, start, parity and stop bits */ -int gbser_set_port(void *handle, unsigned speed, +int gbser_set_port(void* handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop); @@ -59,65 +59,65 @@ int gbser_set_port(void *handle, unsigned speed, * insensitive, spaces are allowed around the commas and omitted * trailing fields will default to '8', 'N' and '1' */ -int gbser_setup(void *handle, const char *spec); +int gbser_setup(void* handle, const char* spec); /* Return true if there are characters available on the serial port */ -int gbser_avail(void *handle); +int gbser_avail(void* handle); /* Read as many bytes as are available without blocking. At most |len| * bytes will be read. Returns the number of bytes read or gbser_ERROR if an * error occurs. */ -int gbser_read(void *handle, void *buf, unsigned len); +int gbser_read(void* handle, void* buf, unsigned len); /* Read the specified number of bytes. Block until the requested number * of bytes have been read or the timeout (in ms) is exceeded. */ -int gbser_read_wait(void *handle, void *buf, unsigned len, unsigned ms); +int gbser_read_wait(void* handle, void* buf, unsigned len, unsigned ms); /* Read from the serial port until the specified |eol| character is * found. Any character matching |discard| will be discarded. To * read lines terminated by 0x0A0x0D discarding linefeeds use * gbser_read_line(h, buf, len, 1000, 0x0D, 0x0A); */ -int gbser_read_line(void *handle, void *buf, +int gbser_read_line(void* handle, void* buf, unsigned len, unsigned ms, int eol, int discard); /* Read a single character from the port, returning immediately if * none are available. TODO: Define return values */ -int gbser_readc(void *handle); +int gbser_readc(void* handle); /* Read a single character from the port, waiting up to |ms| * milliseconds for a character to be available. */ -int gbser_readc_wait(void *handle, unsigned ms); +int gbser_readc_wait(void* handle, unsigned ms); /* Discard any pending input on the serial port. */ -int gbser_flush(void *handle); +int gbser_flush(void* handle); /* Write |len| bytes from |buf| to the serial port. */ -int gbser_write(void *handle, const void *buf, unsigned len); +int gbser_write(void* handle, const void* buf, unsigned len); /* Write a null terminated string in |str| to the serial * port. */ -int gbser_print(void *handle, const char *str); +int gbser_print(void* handle, const char* str); /* Write a single character to the serial port. */ -int gbser_writec(void *handle, int c); +int gbser_writec(void* handle, int c); /* Return true if a port name seems to refer to a serial port. * On Windows this tests the filename (against the regex * /^(\\\\\.\\\\)?com\d+:?$/i). On Posix it returns the value of * isatty() */ -int gbser_is_serial(const char *port_name); +int gbser_is_serial(const char* port_name); /* This isn't part of the above abstraction; it's just a helper for * the other serial modules in the tree. @@ -131,7 +131,7 @@ int gbser_is_serial(const char *port_name); * call to this function. */ -const char *fix_win_serial_name_r(const char *comname, char *obuf, size_t len); -const char *fix_win_serial_name(const char *comname); +const char* fix_win_serial_name_r(const char* comname, char* obuf, size_t len); +const char* fix_win_serial_name(const char* comname); #endif /* GBSER_H */ diff --git a/gpsbabel/gbser_posix.c b/gpsbabel/gbser_posix.c index 39b957b25..aaeb0ca57 100644 --- a/gpsbabel/gbser_posix.c +++ b/gpsbabel/gbser_posix.c @@ -44,9 +44,9 @@ typedef struct { } gbser_handle; /* Wrapper to safely cast a void * into a gbser_handle */ -static gbser_handle *gbser__get_handle(void *p) +static gbser_handle* gbser__get_handle(void* p) { - gbser_handle *h = (gbser_handle *) p; + gbser_handle* h = (gbser_handle*) p; assert(h->magic == MYMAGIC); return h; } @@ -86,12 +86,12 @@ static speed_t mkspeed(unsigned br) typedef struct timeval hp_time; -static void get_time(hp_time *tv) +static void get_time(hp_time* tv) { gettimeofday(tv, NULL); } -static double elapsed(hp_time *tv) +static double elapsed(hp_time* tv) { hp_time now; double ot = (double) tv->tv_sec * 1000 + @@ -104,7 +104,7 @@ static double elapsed(hp_time *tv) return nt - ot; } -static int set_rx_timeout(gbser_handle *h, unsigned vmin, unsigned vtime) +static int set_rx_timeout(gbser_handle* h, unsigned vmin, unsigned vtime) { if (vmin > 255) { vmin = 255; @@ -129,9 +129,9 @@ static int set_rx_timeout(gbser_handle *h, unsigned vmin, unsigned vtime) * ('com1:') are translated into the equivalent name required by * WIN32 */ -void *gbser_init(const char *port_name) +void* gbser_init(const char* port_name) { - gbser_handle *h; + gbser_handle* h; gbser__db(4, "gbser_init(\"%s\")\n", port_name); @@ -171,9 +171,9 @@ failed: /* Close a serial port */ -void gbser_deinit(void *handle) +void gbser_deinit(void* handle) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); tcsetattr(h->fd, TCSAFLUSH, &h->old_tio); close(h->fd); @@ -181,9 +181,9 @@ void gbser_deinit(void *handle) xfree(h); } -int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop) +int gbser_set_port(void* handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); speed_t s; static unsigned bit_flags[] = { @@ -251,11 +251,11 @@ int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, return tcsetattr(h->fd, TCSADRAIN, &h->new_tio) ? gbser_ERROR : gbser_OK; } -unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) +unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); unsigned count = *len; - unsigned char *cp = (unsigned char *) *buf; + unsigned char* cp = (unsigned char*) *buf; if (count > h->inbuf_used) { count = h->inbuf_used; } @@ -266,7 +266,7 @@ unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) h->inbuf_used -= count; *len -= count; cp += count; - *buf = (void *) cp; + *buf = (void*) cp; return count; } @@ -276,10 +276,10 @@ unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) * be updated to indicate the remaining time on exit. * Returns the number of bytes available (>=0) or an error code (<0). */ -int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) +int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms) { int rc; - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); if (want > BUFSIZE) { want = BUFSIZE; @@ -356,9 +356,9 @@ int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) /* Discard any pending input on the serial port. */ -int gbser_flush(void *handle) +int gbser_flush(void* handle) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); h->inbuf_used = 0; if (tcflush(h->fd, TCIFLUSH)) { return gbser_ERROR; @@ -369,10 +369,10 @@ int gbser_flush(void *handle) /* Write |len| bytes from |buf| to the serial port. */ -int gbser_write(void *handle, const void *buf, unsigned len) +int gbser_write(void* handle, const void* buf, unsigned len) { - gbser_handle *h = gbser__get_handle(handle); - const char *bp = (const char *) buf; + gbser_handle* h = gbser__get_handle(handle); + const char* bp = (const char*) buf; int rc; while (len > 0) { /*printf("write(%d, %p, %d)\n", h->fd, bp, len);*/ @@ -392,7 +392,7 @@ int gbser_write(void *handle, const void *buf, unsigned len) * isatty() */ -int gbser_is_serial(const char *port_name) +int gbser_is_serial(const char* port_name) { int fd; int is_port = 0; @@ -421,7 +421,7 @@ int gbser_is_serial(const char *port_name) * call to this function. */ -const char *fix_win_serial_name_r(const char *comname, char *obuf, size_t len) +const char* fix_win_serial_name_r(const char* comname, char* obuf, size_t len) { strncpy(obuf, comname, len); return obuf; @@ -429,7 +429,7 @@ const char *fix_win_serial_name_r(const char *comname, char *obuf, size_t len) static char gb_com_buffer[100]; -const char *fix_win_serial_name(const char *comname) +const char* fix_win_serial_name(const char* comname) { return fix_win_serial_name_r(comname, gb_com_buffer, sizeof(gb_com_buffer)); } @@ -441,9 +441,9 @@ const char *fix_win_serial_name(const char *comname) * The terminating character and any discarded characters are not * stored in the buffer. */ -int gbser_read_line(void *handle, void *buf, unsigned len, unsigned ms, int eol, int discard) +int gbser_read_line(void* handle, void* buf, unsigned len, unsigned ms, int eol, int discard) { - char *bp = (char *) buf; + char* bp = (char*) buf; unsigned pos = 0; hp_time tv; get_time(&tv); diff --git a/gpsbabel/gbser_private.h b/gpsbabel/gbser_private.h index 0681c6576..01f46e6b4 100644 --- a/gpsbabel/gbser_private.h +++ b/gpsbabel/gbser_private.h @@ -22,6 +22,6 @@ #define MYMAGIC 0x91827364 #define BUFSIZE 512 -void gbser__db(int l, const char *msg, ...); -int gbser__fill_buffer(void *h, unsigned want, unsigned *ms); -unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len); +void gbser__db(int l, const char* msg, ...); +int gbser__fill_buffer(void* h, unsigned want, unsigned* ms); +unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len); diff --git a/gpsbabel/gbser_win.c b/gpsbabel/gbser_win.c index 7b7f84850..e60850074 100644 --- a/gpsbabel/gbser_win.c +++ b/gpsbabel/gbser_win.c @@ -41,9 +41,9 @@ typedef struct { #define DEV_PREFIX "\\\\.\\\\" /* Wrapper to safely cast a void * into a gbser_handle */ -static gbser_handle *gbser__get_handle(void *p) +static gbser_handle* gbser__get_handle(void* p) { - gbser_handle *h = (gbser_handle *) p; + gbser_handle* h = (gbser_handle*) p; assert(h->magic == MYMAGIC); return h; } @@ -75,12 +75,12 @@ static DWORD mkspeed(unsigned br) typedef LARGE_INTEGER hp_time; -static void get_time(hp_time *tv) +static void get_time(hp_time* tv) { QueryPerformanceCounter(tv); } -static double elapsed(hp_time *tv) +static double elapsed(hp_time* tv) { hp_time now; LARGE_INTEGER tps; @@ -92,7 +92,7 @@ static double elapsed(hp_time *tv) (double) tps.QuadPart) * 1000; } -static int set_rx_timeout(gbser_handle *h, DWORD timeout) +static int set_rx_timeout(gbser_handle* h, DWORD timeout) { if (timeout != h->timeout) { COMMTIMEOUTS to; @@ -133,8 +133,8 @@ static int set_rx_timeout(gbser_handle *h, DWORD timeout) * call to this function. */ -const char * -fix_win_serial_name_r(const char *comname, char *obuf, size_t len) +const char* +fix_win_serial_name_r(const char* comname, char* obuf, size_t len) { if (!gbser_is_serial(comname) || ((strlen(comname) == 5) && (comname[4] == ':')) || @@ -155,7 +155,7 @@ fix_win_serial_name_r(const char *comname, char *obuf, size_t len) static char gb_com_buffer[100]; -const char *fix_win_serial_name(const char *comname) +const char* fix_win_serial_name(const char* comname) { return fix_win_serial_name_r(comname, gb_com_buffer, sizeof(gb_com_buffer)); } @@ -165,11 +165,11 @@ const char *fix_win_serial_name(const char *comname) * ('com1:') are translated into the equivalent name required by * WIN32 */ -void *gbser_init(const char *port_name) +void* gbser_init(const char* port_name) { HANDLE comport; gbser_handle* h = xcalloc(1, sizeof(*h)); - const char *xname = fix_win_serial_name(port_name); + const char* xname = fix_win_serial_name(port_name); gbser__db(2, "Translated port name: \"%s\"\n", xname); @@ -201,18 +201,18 @@ failed: /* Close a serial port */ -void gbser_deinit(void *handle) +void gbser_deinit(void* handle) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); CloseHandle(h->comport); xfree(h); } -int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop) +int gbser_set_port(void* handle, unsigned speed, unsigned bits, unsigned parity, unsigned stop) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); DCB tio; if (bits < 5 || bits > 8) { @@ -255,11 +255,11 @@ int gbser_set_port(void *handle, unsigned speed, unsigned bits, unsigned parity, return gbser_OK; } -unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) +unsigned gbser__read_buffer(void* handle, void** buf, unsigned* len) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); unsigned count = *len; - unsigned char *cp = *buf; + unsigned char* cp = *buf; if (count > h->inbuf_used) { count = h->inbuf_used; } @@ -270,7 +270,7 @@ unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) h->inbuf_used -= count; *len -= count; cp += count; - *buf = (void *) cp; + *buf = (void*) cp; return count; } @@ -280,10 +280,10 @@ unsigned gbser__read_buffer(void *handle, void **buf, unsigned *len) * be updated to indicate the remaining time on exit. * Returns the number of bytes available (>=0) or an error code (<0). */ -int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) +int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms) { int rc; - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); if (want > BUFSIZE) { want = BUFSIZE; @@ -341,9 +341,9 @@ int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) /* Discard any pending input on the serial port. */ -int gbser_flush(void *handle) +int gbser_flush(void* handle) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); h->inbuf_used = 0; if (!PurgeComm(h->comport, PURGE_RXCLEAR)) { return gbser_ERROR; @@ -353,11 +353,11 @@ int gbser_flush(void *handle) /* Write |len| bytes from |buf| to the serial port. */ -int gbser_write(void *handle, const void *buf, unsigned len) +int gbser_write(void* handle, const void* buf, unsigned len) { - gbser_handle *h = gbser__get_handle(handle); + gbser_handle* h = gbser__get_handle(handle); DWORD nwritten; - const char *bp = buf; + const char* bp = buf; /* Not sure we need to spin here - but this'll work even if we don't */ while (len > 0) { if (!WriteFile(h->comport, bp, len, &nwritten, NULL)) { @@ -375,11 +375,11 @@ int gbser_write(void *handle, const void *buf, unsigned len) * isatty() */ -int gbser_is_serial(const char *port_name) +int gbser_is_serial(const char* port_name) { - const char *pfx = DEV_PREFIX; + const char* pfx = DEV_PREFIX; size_t pfx_l = strlen(pfx); - const char *com = "COM"; + const char* com = "COM"; size_t com_l = strlen(com); unsigned digits; @@ -422,11 +422,11 @@ int gbser_is_serial(const char *port_name) * read lines terminated by 0x0A0x0D discarding linefeeds use * gbser_read_line(h, buf, len, 1000, 0x0D, 0x0A); */ -int gbser_read_line(void *handle, void *buf, +int gbser_read_line(void* handle, void* buf, unsigned len, unsigned ms, int eol, int discard) { - char *bp = buf; + char* bp = buf; unsigned pos = 0; hp_time tv; get_time(&tv); diff --git a/gpsbabel/gcdb.c b/gpsbabel/gcdb.c index a110105a0..6f0c2815c 100644 --- a/gpsbabel/gcdb.c +++ b/gpsbabel/gcdb.c @@ -47,15 +47,15 @@ pdb_16 nflds; struct dbfld dbfld[1]; }; -static pdbfile *file_in, *file_out; -static const char *out_fname; +static pdbfile* file_in, *file_out; +static const char* out_fname; static int ct; -static char *tbuf = NULL; -static char *tbufp = NULL; +static char* tbuf = NULL; +static char* tbufp = NULL; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -67,7 +67,7 @@ pdb_close(file_in); } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -86,20 +86,20 @@ xfree(tbuf); static void data_read(void) { -pdbrec_t *pdb_rec; +pdbrec_t* pdb_rec; if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) { fatal(MYNAME ": Not a GeocachingDB file.\n"); } for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec=pdb_rec->next) { -waypoint *wpt = waypt_new(); -struct dbrec *rec = (struct dbrec *) pdb_rec->data; +waypoint* wpt = waypt_new(); +struct dbrec* rec = (struct dbrec*) pdb_rec->data; int nflds; int length; int type; int i; -char *recdata; +char* recdata; int lat_dir = 0; int lat_deg = 0; float lat_min = 0.0; @@ -108,7 +108,7 @@ int lon_deg = 0; float lon_min = 0.0; nflds = be_read16(&rec->nflds); -recdata = (char *) &rec->dbfld[nflds]; +recdata = (char*) &rec->dbfld[nflds]; for (i = 0; i < nflds; i++) { length = (unsigned short) be_read16(&rec->dbfld[i].fldlen); @@ -170,7 +170,7 @@ waypt_add(wpt); static int -gcdb_add_to_rec(struct dbrec *rec, const char *fldname, gcdb_rectype rectype, void *data) +gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, void* data) { int length; static int rec_cnt; @@ -215,9 +215,9 @@ return length; } static void -gcdb_write_wpt(const waypoint *wpt) +gcdb_write_wpt(const waypoint* wpt) { -struct dbrec *rec; +struct dbrec* rec; int reclen; char tbuf[100]; @@ -266,7 +266,7 @@ gcdb_add_to_rec(rec, "terr", RECTYPE_TEXT, tbuf); * not the cache creation date. */ if (wpt->creation_time) { -gcdb_add_to_rec(rec, "date", RECTYPE_DATE, (void *) wpt->creation_time); +gcdb_add_to_rec(rec, "date", RECTYPE_DATE, (void*) wpt->creation_time); } #endif diff --git a/gpsbabel/gdb.c b/gpsbabel/gdb.c index c1b932d1b..aa8a6c23e 100644 --- a/gpsbabel/gdb.c +++ b/gpsbabel/gdb.c @@ -113,17 +113,17 @@ /* static char gdb_release[] = "$Revision: 1.74 $"; */ static char gdb_release_date[] = "$Date: 2011-04-14 01:30:01 $"; -static gbfile *fin, *fout, *ftmp; +static gbfile* fin, *fout, *ftmp; static int gdb_ver, gdb_category, gdb_via, gdb_roadbook; static queue wayptq_in, wayptq_out, wayptq_in_hidden; static short_handle short_h; -static char *gdb_opt_category; -static char *gdb_opt_ver; -static char *gdb_opt_via; -static char *gdb_opt_roadbook; -static char *gdb_opt_bitcategory; +static char* gdb_opt_category; +static char* gdb_opt_ver; +static char* gdb_opt_via; +static char* gdb_opt_roadbook; +static char* gdb_opt_bitcategory; static int waypt_flag; static int route_flag; @@ -141,12 +141,12 @@ static int trk_ct; /* informational: total number of tracks in/out */ #define NOT_EMPTY(a) (a && *a) static void -gdb_flush_waypt_queue(queue *Q) +gdb_flush_waypt_queue(queue* Q) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(Q, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; dequeue(elem); if (wpt->extra_data) { xfree(wpt->extra_data); @@ -158,7 +158,7 @@ gdb_flush_waypt_queue(queue *Q) #if GDB_DEBUG static void -disp_summary(const gbfile *f) +disp_summary(const gbfile* f) { int i, len; @@ -205,11 +205,11 @@ disp_summary(const gbfile *f) #define FREAD_LATLON GPS_Math_Semi_To_Deg(gbfgetint32(fin)) #if GDB_DEBUG -static char * -nice(const char *str) +static char* +nice(const char* str) { - char *res, *env; - cet_cs_vec_t *vec; + char* res, *env; + cet_cs_vec_t* vec; if (!(str && *str)) { return ""; @@ -217,7 +217,7 @@ nice(const char *str) env = getenv("LANG"); if (env == NULL) { - return (char *)str; + return (char*)str; } if ((res = strchr(env, '.'))) { @@ -232,15 +232,15 @@ nice(const char *str) xfree(res); return buf; } else { - return (char *)str; + return (char*)str; } } #endif -static char * -gdb_fread_cstr(gbfile *fin) +static char* +gdb_fread_cstr(gbfile* fin) { - char *result = gbfgetcstr(fin); + char* result = gbfgetcstr(fin); if (result && (*result == '\0')) { xfree(result); @@ -250,7 +250,7 @@ gdb_fread_cstr(gbfile *fin) } static int -gdb_fread_str(char *buf, int size, gbfile *fin) +gdb_fread_str(char* buf, int size, gbfile* fin) { char c; int res = 0; @@ -267,16 +267,16 @@ gdb_fread_str(char *buf, int size, gbfile *fin) return res; } -static char * +static char* gdb_fread_strlist(void) { - char *res = NULL; + char* res = NULL; int count; count = FREAD_i32; while (count > 0) { - char *str = FREAD_CSTR; + char* str = FREAD_CSTR; if (str != NULL) { if (*str && (res == NULL)) { res = str; @@ -290,14 +290,14 @@ gdb_fread_strlist(void) return res; } -static waypoint * -gdb_find_wayptq(const queue *Q, const waypoint *wpt, const char exact) +static waypoint* +gdb_find_wayptq(const queue* Q, const waypoint* wpt, const char exact) { - queue *elem, *tmp; - const char *name = wpt->shortname; + queue* elem, *tmp; + const char* name = wpt->shortname; QUEUE_FOR_EACH(Q, elem, tmp) { - waypoint *tmp = (waypoint *)elem; + waypoint* tmp = (waypoint*)elem; if (case_ignore_strcmp(name, tmp->shortname) == 0) { if (! exact) { @@ -313,10 +313,10 @@ gdb_find_wayptq(const queue *Q, const waypoint *wpt, const char exact) return NULL; } -static waypoint * -gdb_reader_find_waypt(const waypoint *wpt, const char exact) +static waypoint* +gdb_reader_find_waypt(const waypoint* wpt, const char exact) { - waypoint *res; + waypoint* res; res = gdb_find_wayptq(&wayptq_in, wpt, exact); if (res == NULL) { res = gdb_find_wayptq(&wayptq_in_hidden, wpt, exact); @@ -324,10 +324,10 @@ gdb_reader_find_waypt(const waypoint *wpt, const char exact) return res; } -static waypoint * -gdb_add_route_waypt(route_head *rte, waypoint *ref, const int wpt_class) +static waypoint* +gdb_add_route_waypt(route_head* rte, waypoint* ref, const int wpt_class) { - waypoint *tmp, *res; + waypoint* tmp, *res; int turn_point; tmp = gdb_reader_find_waypt(ref, 1); @@ -381,7 +381,7 @@ gdb_add_route_waypt(route_head *rte, waypoint *ref, const int wpt_class) #define FWRITE_LATLON(a) gbfputint32(GPS_Math_Deg_To_Semi((a)),fout) static void -gdb_write_cstr_list(const char *str) +gdb_write_cstr_list(const char* str) { if NOT_EMPTY(str) { gbfputint32(1, fout); @@ -451,7 +451,7 @@ read_file_header(void) reclen = FREAD_i32; i = FREAD(buf, reclen + 1); if (global_opts.verbose_status > 0) { - char *name = buf+2; + char* name = buf+2; if (strstr(name, "SQA") == 0) { name = "MapSource"; } else if (strstr(name, "neaderhi") == 0) { @@ -466,28 +466,28 @@ read_file_header(void) /*-----------------------------------------------------------------------------*/ -static waypoint * -read_waypoint(gt_waypt_classes_e *waypt_class_out) +static waypoint* +read_waypoint(gt_waypt_classes_e* waypt_class_out) { char buf[128]; /* used for temporary stuff */ int display, icon, dynamic; gt_waypt_classes_e wpt_class; int i; - waypoint *res; - garmin_fs_t *gmsd; - char *str; - char *bufp = buf; + waypoint* res; + garmin_fs_t* gmsd; + char* str; + char* bufp = buf; #ifdef GMSD_EXPERIMENTAL char subclass[22]; #endif #if GDB_DEBUG - char *sn; + char* sn; #endif waypt_ct++; res = waypt_new(); gmsd = garmin_fs_alloc(-1); - fs_chain_add(&res->fs, (format_specific_data *) gmsd); + fs_chain_add(&res->fs, (format_specific_data*) gmsd); res->shortname = FREAD_CSTR; #if GDB_DEBUG @@ -535,7 +535,7 @@ read_waypoint(gt_waypt_classes_e *waypt_class_out) res->notes = FREAD_CSTR; #if GDB_DEBUG DBG(GDB_DBG_WPTe, res->notes) { - char *str = gstrsub(res->notes, "\r\n", ", "); + char* str = gstrsub(res->notes, "\r\n", ", "); printf(MYNAME "-wpt \"%s\" (%d): notes = %s\n", sn, wpt_class, nice(str)); xfree(str); @@ -592,7 +592,7 @@ read_waypoint(gt_waypt_classes_e *waypt_class_out) /* VERSION DEPENDENT CODE */ if (gdb_ver <= GDB_VER_2) { - char *temp; + char* temp; FREAD(buf, 2); /* ?????????????????????????????????? */ waypt_flag = FREAD_C; @@ -630,7 +630,7 @@ read_waypoint(gt_waypt_classes_e *waypt_class_out) url_ct = FREAD_i32; for (i = url_ct; (i); i--) { - char *str = FREAD_CSTR; + char* str = FREAD_CSTR; if (str && *str) { waypt_add_url(res, str, NULL); #if GDB_DEBUG @@ -722,10 +722,10 @@ read_waypoint(gt_waypt_classes_e *waypt_class_out) /*-----------------------------------------------------------------------------*/ -static route_head * +static route_head* read_route(void) { - route_head *rte; + route_head* rte; int points, warnings, links, i; char buf[128]; bounds bounds; @@ -765,9 +765,9 @@ read_route(void) for (i = 0; i < points; i++) { int wpt_class, j; char buf[128]; - garmin_ilink_t *il_root, *il_anchor; + garmin_ilink_t* il_root, *il_anchor; - waypoint *wpt; + waypoint* wpt; wpt = waypt_new(); rtept_ct++; @@ -811,7 +811,7 @@ read_route(void) nice(wpt->shortname), wpt_class, links); #endif for (j = 0; j < links; j++) { - garmin_ilink_t *il_step = xmalloc(sizeof(*il_step)); + garmin_ilink_t* il_step = (garmin_ilink_t*) xmalloc(sizeof(*il_step)); il_step->ref_count = 1; @@ -864,7 +864,7 @@ read_route(void) if (links == 0) { /* Without links we need all informations from wpt */ - waypoint *tmp = gdb_reader_find_waypt(wpt, 0); + waypoint* tmp = gdb_reader_find_waypt(wpt, 0); if (tmp != NULL) { waypt_free(wpt); wpt = waypt_dupe(tmp); @@ -894,10 +894,10 @@ read_route(void) #endif wpt = gdb_add_route_waypt(rte, wpt, wpt_class); if (wpt != NULL) { - garmin_fs_t *gmsd = GMSD_FIND(wpt); + garmin_fs_t* gmsd = GMSD_FIND(wpt); if (gmsd == NULL) { gmsd = garmin_fs_alloc(-1); - fs_chain_add(&wpt->fs, (format_specific_data *) gmsd); + fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } GMSD_SET(wpt_class, wpt_class); gmsd->ilinks = il_root; @@ -905,7 +905,7 @@ read_route(void) } while (il_root) { - garmin_ilink_t *il = il_root; + garmin_ilink_t* il = il_root; il_root = il_root->next; xfree(il); } @@ -925,7 +925,7 @@ read_route(void) #if 0 /* replace CRLF's with ", " */ if (rte->rte_desc) { - char *c = rte->rte_desc; + char* c = rte->rte_desc; while ((c = strstr(c, "\r\n"))) { *c++ = ','; *c++ = ' '; @@ -938,10 +938,10 @@ read_route(void) /*-----------------------------------------------------------------------------*/ -static route_head * +static route_head* read_track(void) { - route_head *res; + route_head* res; int points, index; char dummy; int color_idx; @@ -959,7 +959,7 @@ read_track(void) points = FREAD_i32; for (index = 0; index < points; index++) { - waypoint *wpt = waypt_new(); + waypoint* wpt = waypt_new(); trkpt_ct++; @@ -1001,7 +1001,7 @@ read_track(void) /*******************************************************************************/ static void -gdb_rd_init(const char *fname) +gdb_rd_init(const char* fname) { fin = gbfopen_le(fname, "rb", MYNAME); ftmp = gbfopen_le(NULL, "wb", MYNAME); @@ -1041,15 +1041,15 @@ gdb_rd_deinit(void) static void read_data(void) { - gbfile *fsave; + gbfile* fsave; int incomplete = 0; /* number of incomplete reads */ for (;;) { int len, delta; char typ, dump; gt_waypt_classes_e wpt_class; - waypoint *wpt; - route_head *trk, *rte; + waypoint* wpt; + route_head* trk, *rte; len = FREAD_i32; if (FREAD(&typ, 1) < 1) { @@ -1074,7 +1074,7 @@ read_data(void) case 'W': wpt = read_waypoint(&wpt_class); if ((gdb_via == 0) || (wpt_class == 0)) { - waypoint *dupe; + waypoint* dupe; waypt_add(wpt); dupe = waypt_dupe(wpt); ENQUEUE_TAIL(&wayptq_in, &dupe->Q); @@ -1120,7 +1120,7 @@ read_data(void) } if (delta > 0) { int i; - char *buf = xmalloc(delta); + char* buf = (char*) xmalloc(delta); if (FREAD(buf, delta) < 1) { fatal(MYNAME ": Attempt to read past EOF.\n"); } @@ -1151,7 +1151,7 @@ read_data(void) * reset_short_handle: used for waypoint, route and track names */ static void -reset_short_handle(const char *defname) +reset_short_handle(const char* defname) { if (short_h != NULL) { mkshort_del_handle(&short_h); @@ -1174,7 +1174,7 @@ static void write_header(void) { char buff[128], tbuff[32]; - char *c; + char* c; int len; struct tm tm; @@ -1239,7 +1239,7 @@ write_header(void) */ static void -gdb_check_waypt(waypoint *wpt) +gdb_check_waypt(waypoint* wpt) { double lat_orig = wpt->latitude; double lon_orig = wpt->longitude; @@ -1267,7 +1267,7 @@ gdb_check_waypt(waypoint *wpt) static void write_waypoint( - const waypoint *wpt, const char *shortname, garmin_fs_t *gmsd, + const waypoint* wpt, const char* shortname, garmin_fs_t* gmsd, const int icon, const int display) { char zbuf[32], ffbuf[32]; @@ -1320,7 +1320,7 @@ write_waypoint( /* VERSION DEPENDENT CODE */ if (gdb_ver <= GDB_VER_2) { - char *descr; + char* descr; FWRITE(zbuf, 3); FWRITE(zbuf, 4); @@ -1333,8 +1333,8 @@ write_waypoint( FWRITE_CSTR(descr); } else { /* if (gdb_ver > GDB_VER_3) */ int cnt; - url_link *url_next; - const char *str; + url_link* url_next; + const char* str; if (wpt_class < gt_waypt_class_map_point) { /* street address */ str = GMSD_GET(addr, ""); @@ -1380,7 +1380,7 @@ write_waypoint( /* VERSION DEPENDENT CODE */ if (gdb_ver >= GDB_VER_3) { - const char *str = GMSD_GET(phone_nr, ""); + const char* str = GMSD_GET(phone_nr, ""); if (*str) { FWRITE_i32(1); FWRITE_CSTR(str); @@ -1394,19 +1394,19 @@ write_waypoint( } static void -route_compute_bounds(const route_head *rte, bounds *bounds) +route_compute_bounds(const route_head* rte, bounds* bounds) { - queue *elem, *tmp; + queue* elem, *tmp; waypt_init_bounds(bounds); - QUEUE_FOR_EACH((queue *)&rte->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; gdb_check_waypt(wpt); waypt_add_to_bounds(bounds, wpt); } } static void -route_write_bounds(bounds *bounds) +route_write_bounds(bounds* bounds) { if (waypt_bounds_valid(bounds)) { FWRITE_C(0); @@ -1422,11 +1422,11 @@ route_write_bounds(bounds *bounds) } static void -write_route(const route_head *rte, const char *rte_name) +write_route(const route_head* rte, const char* rte_name) { bounds bounds; int points, index; - queue *elem, *tmp; + queue* elem, *tmp; char zbuf[32], ffbuf[32]; memset(zbuf, 0, sizeof(zbuf)); @@ -1443,12 +1443,12 @@ write_route(const route_head *rte, const char *rte_name) index = 0; - QUEUE_FOR_EACH((queue *)&rte->waypoint_list, elem, tmp) { + QUEUE_FOR_EACH((queue*)&rte->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; - waypoint *next = (waypoint *)tmp; - waypoint *test; - garmin_fs_t *gmsd = NULL; + waypoint* wpt = (waypoint*)elem; + waypoint* next = (waypoint*)tmp; + waypoint* test; + garmin_fs_t* gmsd = NULL; int wpt_class; index++; @@ -1471,7 +1471,7 @@ write_route(const route_head *rte, const char *rte_name) gmsd = GMSD_FIND(wpt); /* extra_data may contain a modified shortname */ - FWRITE_CSTR((wpt->extra_data) ? (char *)wpt->extra_data : wpt->shortname); + FWRITE_CSTR((wpt->extra_data) ? (char*)wpt->extra_data : wpt->shortname); wpt_class = wpt->microseconds; /* trick */ @@ -1537,9 +1537,9 @@ write_route(const route_head *rte, const char *rte_name) } static void -write_track(const route_head *trk, const char *trk_name) +write_track(const route_head* trk, const char* trk_name) { - queue *elem, *tmp; + queue* elem, *tmp; int points = ELEMENTS(trk); FWRITE_CSTR(trk_name); @@ -1549,9 +1549,9 @@ write_track(const route_head *trk, const char *trk_name) FWRITE_i32(points); /* total number of waypoints in waypoint list */ - QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) { + QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { double d; - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; trkpt_ct++; /* increase informational number of written route points */ @@ -1578,7 +1578,7 @@ write_track(const route_head *trk, const char *trk_name) /*-----------------------------------------------------------------------------*/ static void -finalize_item(gbfile *origin, const char identifier) +finalize_item(gbfile* origin, const char identifier) { int len = gbftell(fout); @@ -1596,7 +1596,7 @@ finalize_item(gbfile *origin, const char identifier) /*-----------------------------------------------------------------------------*/ static char -str_not_equal(const char *s1, const char *s2) +str_not_equal(const char* s1, const char* s2) { if (s1) { if (!s2) { @@ -1615,15 +1615,15 @@ str_not_equal(const char *s1, const char *s2) } static void -write_waypoint_cb(const waypoint *refpt) +write_waypoint_cb(const waypoint* refpt) { - garmin_fs_t *gmsd; - waypoint *test; - gbfile *fsave; + garmin_fs_t* gmsd; + waypoint* test; + gbfile* fsave; /* do this when backup always happens in main */ - rtrim(((waypoint *)refpt)->shortname); + rtrim(((waypoint*)refpt)->shortname); test = gdb_find_wayptq(&wayptq_out, refpt, 1); if ((test != NULL) && (route_flag == 0)) { @@ -1635,8 +1635,8 @@ write_waypoint_cb(const waypoint *refpt) if (test == NULL) { int icon, display, wpt_class; - char *name; - waypoint *wpt = waypt_dupe(refpt); + char* name; + waypoint* wpt = waypt_dupe(refpt); gdb_check_waypt(wpt); ENQUEUE_TAIL(&wayptq_out, &wpt->Q); @@ -1694,7 +1694,7 @@ write_waypoint_cb(const waypoint *refpt) } name = mkshort(short_h, name); - wpt->extra_data = (void *)name; + wpt->extra_data = (void*)name; write_waypoint(wpt, name, gmsd, icon, display); finalize_item(fsave, 'W'); @@ -1702,10 +1702,10 @@ write_waypoint_cb(const waypoint *refpt) } static void -write_route_cb(const route_head *rte) +write_route_cb(const route_head* rte) { - gbfile *fsave; - char *name; + gbfile* fsave; + char* name; char buf[32]; if (ELEMENTS(rte) <= 0) { @@ -1730,10 +1730,10 @@ write_route_cb(const route_head *rte) } static void -write_track_cb(const route_head *trk) +write_track_cb(const route_head* trk) { - gbfile *fsave; - char *name; + gbfile* fsave; + char* name; char buf[32]; if (ELEMENTS(trk) <= 0) { @@ -1760,7 +1760,7 @@ write_track_cb(const route_head *trk) /*-----------------------------------------------------------------------------*/ static void -gdb_wr_init(const char *fname) +gdb_wr_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); ftmp = gbfopen_le(NULL, "wb", MYNAME); diff --git a/gpsbabel/geo.c b/gpsbabel/geo.c index 5b118eca7..c897613a1 100644 --- a/gpsbabel/geo.c +++ b/gpsbabel/geo.c @@ -19,12 +19,12 @@ #include "defs.h" #include "xmlgeneric.h" -static char *deficon = NULL; -static char *nuke_placer; +static char* deficon = NULL; +static char* nuke_placer; -static waypoint *wpt_tmp; +static waypoint* wpt_tmp; -static gbfile *ofd; +static gbfile* ofd; static arglist_t geo_args[] = { @@ -38,7 +38,7 @@ arglist_t geo_args[] = { #if ! HAVE_LIBEXPAT static void -geo_rd_init(const char *fname) +geo_rd_init(const char* fname) { fatal(MYNAME ": This build excluded GEO support because expat was not installed.\n"); } @@ -70,7 +70,7 @@ xg_tag_mapping loc_map[] = { { NULL, (xg_cb_type)0, NULL } }; -void wpt_s(const char *args, const char **unused) +void wpt_s(const char* args, const char** unused) { wpt_tmp = waypt_new(); /* @@ -82,14 +82,14 @@ void wpt_s(const char *args, const char **unused) wpt_tmp->altitude = 0; } -void wpt_e(const char *args, const char **unused) +void wpt_e(const char* args, const char** unused) { waypt_add(wpt_tmp); } -void wpt_name_s(const char *args, const char **attrv) +void wpt_name_s(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (0 == strcmp(avp[0], "id")) { wpt_tmp->shortname = xstrdup(avp[1]); @@ -98,9 +98,9 @@ void wpt_name_s(const char *args, const char **attrv) } } -void wpt_name(const char *args, const char **unused) +void wpt_name(const char* args, const char** unused) { - char *s; + char* s; if (!args) { return; } @@ -116,9 +116,9 @@ void wpt_name(const char *args, const char **unused) } } -void wpt_link_s(const char *args, const char **attrv) +void wpt_link_s(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (0 == strcmp(avp[0], "text")) { wpt_tmp->url_link_text = xstrdup(avp[1]); @@ -126,20 +126,20 @@ void wpt_link_s(const char *args, const char **attrv) avp+=2; } } -void wpt_link(const char *args, const char **attrv) +void wpt_link(const char* args, const char** attrv) { wpt_tmp->url = xstrdup(args); } -void wpt_type(const char *args, const char **unused) +void wpt_type(const char* args, const char** unused) { wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1; wpt_tmp->icon_descr = xstrdup(args); } -void wpt_coord(const char *args, const char **attrv) +void wpt_coord(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (strcmp(avp[0], "lat") == 0) { @@ -153,7 +153,7 @@ void wpt_coord(const char *args, const char **attrv) } } -void wpt_container(const char *args, const char **unused) +void wpt_container(const char* args, const char** unused) { int v; @@ -189,7 +189,7 @@ void wpt_container(const char *args, const char **unused) waypt_alloc_gc_data(wpt_tmp)->container = v; } -void wpt_diff(const char *args, const char **unused) +void wpt_diff(const char* args, const char** unused) { if (!args) { return; @@ -197,7 +197,7 @@ void wpt_diff(const char *args, const char **unused) waypt_alloc_gc_data(wpt_tmp)->diff = atof(args) * 10; } -void wpt_terr(const char *args, const char **unused) +void wpt_terr(const char* args, const char** unused) { if (!args) { return; @@ -206,7 +206,7 @@ void wpt_terr(const char *args, const char **unused) } static void -geo_rd_init(const char *fname) +geo_rd_init(const char* fname) { xml_init(fname, loc_map, NULL); } @@ -225,7 +225,7 @@ geo_rd_deinit(void) } static void -geo_wr_init(const char *fname) +geo_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); } @@ -237,9 +237,9 @@ geo_wr_deinit(void) } static void -geo_waypt_pr(const waypoint *waypointp) +geo_waypt_pr(const waypoint* waypointp) { - char *tmp; + char* tmp; gbfprintf(ofd, "\n"); gbfprintf(ofd, "", waypointp->shortname); diff --git a/gpsbabel/geoniche.c b/gpsbabel/geoniche.c index ab0a5e3bb..6cd53441d 100644 --- a/gpsbabel/geoniche.c +++ b/gpsbabel/geoniche.c @@ -36,14 +36,14 @@ #undef GEONICHE_DBG -static pdbfile *file_in, *file_out; -static const char *FilenameOut; +static pdbfile* file_in, *file_out; +static const char* FilenameOut; static int rec_ct; static int ct; static char Rec0Magic[] = "68000NV4Q2"; -static char *Arg_dbname = NULL; -static char *Arg_category = NULL; +static char* Arg_dbname = NULL; +static char* Arg_category = NULL; static arglist_t Args[] = { @@ -67,9 +67,9 @@ static char GcSet[] = "0123456789ABCDEFGHJKMNPQRTVWXYZ"; static int GcOffset = 16 * 31 * 31 * 31 - 65536; static int -gid2id(char *gid) +gid2id(char* gid) { - char *p; + char* p; int i, val; if (strncmp(gid, "GC", 2) != 0) { @@ -122,7 +122,7 @@ id2gid(char gid[6+1], int id) } static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -136,7 +136,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); FilenameOut = fname; @@ -150,12 +150,12 @@ wr_deinit(void) ARG_FREE(Arg_category); } -static char * -field(char **pp, int *lenp) +static char* +field(char** pp, int* lenp) { int len = *lenp; - char *p = *pp; - char *dp, *dbuf; + char* p = *pp; + char* dp, *dbuf; int state = 0; if (len == 0 || *p == 0) { @@ -199,30 +199,30 @@ eof: static void geoniche_read_asc(void) { - pdbrec_t *pdb_rec; + pdbrec_t* pdb_rec; /* Process record 0 */ pdb_rec = file_in->rec_list; - if (strcmp((char *) pdb_rec->data, Rec0Magic)) { + if (strcmp((char*) pdb_rec->data, Rec0Magic)) { fatal(MYNAME ": Bad record 0, not a GeoNiche file.\n"); } pdb_rec = pdb_rec->next; /* Process the rest of the records */ for (; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt; - char *vdata; + waypoint* wpt; + char* vdata; int vlen; - char *p; + char* p; int id; int route_id; - char *title; - char *category; + char* title; + char* category; double lat, lon, alt; - char *datestr, *timestr; + char* datestr, *timestr; int icon; - char *notes; + char* notes; char gid[6+1]; struct tm tm; @@ -232,7 +232,7 @@ geoniche_read_asc(void) if (!wpt) { fatal(MYNAME ": Couldn't allocate waypoint.\n"); } - vdata = (char *) pdb_rec->data; + vdata = (char*) pdb_rec->data; vlen = pdb_rec->size; /* Field 1: Target */ @@ -404,7 +404,7 @@ geoniche_read_asc(void) } } -static const char *geoniche_icon_map[] = /* MPS */ +static const char* geoniche_icon_map[] = /* MPS */ { /* 21 */ "Cross", /* 22 */ "Cross (light)", @@ -458,10 +458,10 @@ static const char *geoniche_icon_map[] = /* MPS */ /* 52 */ "Mystery or puzzle Cache", }; -static const char * +static const char* geoniche_icon_to_descr(const int no) { - const char *result = NULL; + const char* result = NULL; if (no >= 0x21) { int i = no - 0x21; @@ -478,17 +478,17 @@ geoniche_icon_to_descr(const int no) static void geoniche_read_bin(void) { - pdbrec_t *pdb_rec; + pdbrec_t* pdb_rec; /* Process records */ for (pdb_rec = file_in->rec_list; pdb_rec != NULL; pdb_rec = pdb_rec->next) { - char *vdata = (char *) pdb_rec->data; + char* vdata = (char*) pdb_rec->data; struct tm created, visited; int icon_nr, selected; int latdeg, londeg; double lat, lon, altitude; - waypoint *waypt; + waypoint* waypt; memset(&visited, 0, sizeof(visited)); memset(&created, 0, sizeof(created)); @@ -574,10 +574,10 @@ data_read(void) } } -static char * -enscape(char *s) +static char* +enscape(char* s) { - char *buf, *d; + char* buf, *d; if (!s) { d = xmalloc(1); @@ -614,9 +614,9 @@ enscape(char *s) * Attempt to map an icon description into a GeoNiche icon number */ static int -wpt2icon(const waypoint *wpt) +wpt2icon(const waypoint* wpt) { - const char *desc = wpt->icon_descr; + const char* desc = wpt->icon_descr; if (!desc) { return 0; @@ -680,10 +680,10 @@ wpt2icon(const waypoint *wpt) return 0; } -static char * -geoniche_geostuff(const waypoint *wpt) +static char* +geoniche_geostuff(const waypoint* wpt) { - char *gs = NULL, *tmp1, *tmp2, *tmp3; + char* gs = NULL, *tmp1, *tmp2, *tmp3; char tbuf[10240]; if (!wpt->gc_data->terr) { @@ -726,18 +726,18 @@ geoniche_geostuff(const waypoint *wpt) } static void -geoniche_writewpt(const waypoint *wpt) +geoniche_writewpt(const waypoint* wpt) { int vlen; - char *vdata; - char *title; + char* vdata; + char* title; struct tm tm; char datestr[10+1]; char timestr[8+1]; - char *notes; + char* notes; int id; time_t tx; - char *gs; + char* gs; if (rec_ct == 0) { pdb_write_rec(file_out, 0, 0, ct++, Rec0Magic, sizeof(Rec0Magic)); diff --git a/gpsbabel/ggv_log.c b/gpsbabel/ggv_log.c index 933441251..5372b5081 100644 --- a/gpsbabel/ggv_log.c +++ b/gpsbabel/ggv_log.c @@ -29,7 +29,7 @@ #define MYNAME "ggv_log" -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int ggv_log_ver; static @@ -42,7 +42,7 @@ arglist_t ggv_log_args[] = { *******************************************************************************/ static void -ggv_log_rd_init(const char *fname) +ggv_log_rd_init(const char* fname) { static char magic[32]; int len = 0; @@ -61,7 +61,7 @@ ggv_log_rd_init(const char *fname) if (cin == '\0') { double ver = 0; - char *sver; + char* sver; if (strncmp(magic, "DOMGVGPS Logfile V", 18) != 0) { break; } @@ -90,9 +90,9 @@ ggv_log_rd_deinit(void) static void ggv_log_read(void) { - signed char *buf; + signed char* buf; int bufsz = 0, len; - route_head *trk = NULL; + route_head* trk = NULL; switch (ggv_log_ver) { case 10: @@ -110,7 +110,7 @@ ggv_log_read(void) double xlat, xlon; float sec; struct tm tm; - waypoint *wpt; + waypoint* wpt; if (len != bufsz) { break; @@ -188,7 +188,7 @@ ggv_log_read(void) } static void -ggv_log_wr_init(const char *fname) +ggv_log_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); @@ -202,17 +202,17 @@ ggv_log_wr_deinit(void) } static void -ggv_log_track_head_cb(const route_head *trk) +ggv_log_track_head_cb(const route_head* trk) { - queue *elem, *tmp; - waypoint *prev = NULL; + queue* elem, *tmp; + waypoint* prev = NULL; - QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) { + QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { double latmin, lonmin, latsec, lonsec; int latint, lonint; double course = 0, speed = 0; struct tm tm; - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; double secs = 0; latint = wpt->latitude; @@ -273,7 +273,7 @@ ff_vecs_t ggv_log_vecs = { ff_type_file, { ff_cap_none, /* waypoints */ - ff_cap_read | ff_cap_write, /* tracks */ + (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */ ff_cap_none /* routes */ }, ggv_log_rd_init, diff --git a/gpsbabel/ggv_ovl.c b/gpsbabel/ggv_ovl.c index 29622ad7b..169fe94ed 100644 --- a/gpsbabel/ggv_ovl.c +++ b/gpsbabel/ggv_ovl.c @@ -65,8 +65,8 @@ typedef enum { # "zoom": # "art": line-style */ -static inifile_t *inifile; -static gbfile *fout; +static inifile_t* inifile; +static gbfile* fout; static int symbol_ct; /* Number of symbols written */ static int group_ct; /* Group number during write */ @@ -79,7 +79,7 @@ static OVL_COLOR_TYP color; *******************************************************************************/ static void -ggv_ovl_rd_init(const char *fname) +ggv_ovl_rd_init(const char* fname) { inifile = inifile_init(fname, MYNAME); if (inifile->unicode) { @@ -117,8 +117,8 @@ ggv_ovl_read(void) switch (type) { char coord[32]; - waypoint *wpt; - char *cx; + waypoint* wpt; + char* cx; int group; case OVL_SYMBOL_LINE: @@ -130,7 +130,7 @@ ggv_ovl_read(void) if (points > 0) { int j; - route_head *rte, *trk; + route_head* rte, *trk; rte = trk = route_head_alloc(); if (group > 1) { @@ -202,18 +202,18 @@ ggv_ovl_read(void) /* prototypes used in main functions */ -static void waypt_disp_cb(const waypoint *wpt); -static void track_disp_cb(const route_head *trk); -static void route_disp_cb(const route_head *rte); +static void waypt_disp_cb(const waypoint* wpt); +static void track_disp_cb(const route_head* trk); +static void route_disp_cb(const route_head* rte); static void write_bounds(void); -static void draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint *wpt); -static int get_direction(const waypoint *A, const waypoint *B); +static void draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint* wpt); +static int get_direction(const waypoint* A, const waypoint* B); // static void draw_symbol_text(const char *text, const waypoint *reference); /* -----------------------------------------------------------------------*/ static void -ggv_ovl_wr_init(const char *fname) +ggv_ovl_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); @@ -254,7 +254,7 @@ ggv_ovl_write(void) /**************************************************************************/ static void -waypt_disp_cb(const waypoint *wpt) +waypt_disp_cb(const waypoint* wpt) { draw_symbol_basics(OVL_SYMBOL_CIRCLE, 1, color, wpt); gbfprintf(fout, "Width=20\n"); @@ -269,10 +269,10 @@ waypt_disp_cb(const waypoint *wpt) /* -----------------------------------------------------------------------*/ static void -track_disp_cb(const route_head *trk) +track_disp_cb(const route_head* trk) { int i; - queue *elem, *tmp; + queue* elem, *tmp; int waypt_ct = trk->rte_waypt_ct; if (waypt_ct <= 0) { @@ -289,7 +289,7 @@ track_disp_cb(const route_head *trk) QUEUE_FOR_EACH(&(trk->waypoint_list), elem, tmp) { - waypoint *wpt = (waypoint *) elem; + waypoint* wpt = (waypoint*) elem; gbfprintf(fout, "XKoord%d=%0.8f\n", i, wpt->longitude); gbfprintf(fout, "YKoord%d=%0.8f\n", i, wpt->latitude); @@ -301,11 +301,11 @@ track_disp_cb(const route_head *trk) /* -----------------------------------------------------------------------*/ static void -route_disp_cb(const route_head *rte) +route_disp_cb(const route_head* rte) { int i; - queue *elem, *tmp; - waypoint *prev; + queue* elem, *tmp; + waypoint* prev; int waypt_ct = rte->rte_waypt_ct; if (waypt_ct <= 0) { @@ -321,7 +321,7 @@ route_disp_cb(const route_head *rte) QUEUE_FOR_EACH(&(rte->waypoint_list), elem, tmp) { - waypoint *wpt = (waypoint *) elem; + waypoint* wpt = (waypoint*) elem; if (prev != NULL) { draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, 9 /* color */, prev); @@ -342,7 +342,7 @@ route_disp_cb(const route_head *rte) /* -----------------------------------------------------------------------*/ static void -waypt_bound_calc(const waypoint *waypointp) +waypt_bound_calc(const waypoint* waypointp) { waypt_add_to_bounds(&all_bounds, waypointp); } @@ -370,7 +370,7 @@ write_bounds(void) } static void -draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint *wpt) +draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP color, const waypoint* wpt) { symbol_ct++; @@ -390,7 +390,7 @@ draw_symbol_basics(const OVL_SYMBOL_TYP typ, const int art, const OVL_COLOR_TYP /* the following code comes from first overlay module */ static int -get_direction(const waypoint *A, const waypoint *B) +get_direction(const waypoint* A, const waypoint* B) { double lata, lona, latb, lonb; double dist, dir; @@ -419,7 +419,7 @@ get_direction(const waypoint *A, const waypoint *B) #if 0 static void -draw_symbol_text(const char *text, const waypoint *reference) +draw_symbol_text(const char* text, const waypoint* reference) { waypoint wpt; diff --git a/gpsbabel/glogbook.c b/gpsbabel/glogbook.c index e85df40e4..b42b6abeb 100644 --- a/gpsbabel/glogbook.c +++ b/gpsbabel/glogbook.c @@ -22,9 +22,9 @@ #include "defs.h" #include "xmlgeneric.h" -static gbfile *ofd; -static waypoint *wpt_tmp; -static route_head *trk_head; +static gbfile* ofd; +static waypoint* wpt_tmp; +static route_head* trk_head; #define MYNAME "glogbook" @@ -51,11 +51,11 @@ static xg_tag_mapping gl_map[] = { { gl_trk_long, cb_cdata, "/History/Run/Track/Trackpoint/Position/Longitude" }, { gl_trk_alt, cb_cdata, "/History/Run/Track/Trackpoint/Position/Altitude" }, { gl_trk_utc, cb_cdata, "/History/Run/Track/Trackpoint/Time" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; static void -glogbook_rd_init(const char *fname) +glogbook_rd_init(const char* fname) { xml_init(fname, gl_map, NULL); } @@ -73,7 +73,7 @@ glogbook_rd_deinit(void) } static void -glogbook_wr_init(const char *fname) +glogbook_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); } @@ -85,7 +85,7 @@ glogbook_wr_deinit(void) } static void -glogbook_waypt_pr(const waypoint *wpt) +glogbook_waypt_pr(const waypoint* wpt) { gbfprintf(ofd, " \n"); gbfprintf(ofd, " \n"); @@ -101,13 +101,13 @@ glogbook_waypt_pr(const waypoint *wpt) } static void -glogbook_hdr(const route_head *rte) +glogbook_hdr(const route_head* rte) { gbfprintf(ofd, " \n"); } static void -glogbook_ftr(const route_head *rte) +glogbook_ftr(const route_head* rte) { gbfprintf(ofd, " \n"); } @@ -123,44 +123,44 @@ glogbook_write(void) gbfprintf(ofd, "\n"); } -void gl_trk_s(const char *args, const char **unused) +void gl_trk_s(const char* args, const char** unused) { trk_head = route_head_alloc(); track_add_head(trk_head); } #if 0 -void gl_trk_ident(const char *args, const char **unused) +void gl_trk_ident(const char* args, const char** unused) { trk_head->rte_name = xstrdup(args); } #endif -void gl_trk_pnt_s(const char *args, const char **unused) +void gl_trk_pnt_s(const char* args, const char** unused) { wpt_tmp = waypt_new(); } -void gl_trk_pnt_e(const char *args, const char **unused) +void gl_trk_pnt_e(const char* args, const char** unused) { track_add_wpt(trk_head, wpt_tmp); } -void gl_trk_utc(const char *args, const char **unused) +void gl_trk_utc(const char* args, const char** unused) { wpt_tmp->creation_time = xml_parse_time(args, &wpt_tmp->microseconds); } -void gl_trk_lat(const char *args, const char **unused) +void gl_trk_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } -void gl_trk_long(const char *args, const char **unused) +void gl_trk_long(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } -void gl_trk_alt(const char *args, const char **unused) +void gl_trk_alt(const char* args, const char** unused) { wpt_tmp->altitude = atof(args); } @@ -169,7 +169,7 @@ void gl_trk_alt(const char *args, const char **unused) ff_vecs_t glogbook_vecs = { ff_type_file, - { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none}, + { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none}, glogbook_rd_init, glogbook_wr_init, glogbook_rd_deinit, diff --git a/gpsbabel/gnav_trl.c b/gpsbabel/gnav_trl.c index fcc121b6f..dc5216dee 100644 --- a/gpsbabel/gnav_trl.c +++ b/gpsbabel/gnav_trl.c @@ -37,20 +37,20 @@ typedef struct gnav_trl_s { gbuint32 alt; } gnav_trl_t; -static gbfile *fin, *fout; +static gbfile* fin, *fout; /******************************************************************************* * %%% global callbacks called by gpsbabel main process %%% * *******************************************************************************/ static void -gnav_trl_rd_init(const char *fname) +gnav_trl_rd_init(const char* fname) { fin = gbfopen_le(fname, "rb", MYNAME); } static void -gnav_trl_rw_init(const char *fname) +gnav_trl_rw_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); } @@ -68,19 +68,19 @@ gnav_trl_rw_deinit(void) } static double -read_altitude(void *ptr) +read_altitude(void* ptr) { - unsigned char *i = (unsigned char *) ptr; + unsigned char* i = (unsigned char*) ptr; char buf[sizeof(float)]; le_write32(&buf, i[2] << 24 | i[1] << 16 | i[0] <<8 | i[3]); return le_read_float(&buf); } static void -write_altitude(void *ptr, const float alt) +write_altitude(void* ptr, const float alt) { char buf[sizeof(float)]; - unsigned char *i = (unsigned char *) &buf; + unsigned char* i = (unsigned char*) &buf; le_write_float(&buf, alt); le_write32(ptr, i[0] << 24 | i[3] << 16 | i[2] << 8 | i[1]); } @@ -88,11 +88,11 @@ write_altitude(void *ptr, const float alt) static void gnav_trl_read(void) { - route_head *trk = NULL; + route_head* trk = NULL; while (! gbfeof(fin)) { gnav_trl_t rec; - waypoint *wpt; + waypoint* wpt; if (gbfread(&rec, sizeof(rec), 1, fin) != 1) { fatal(MYNAME ": Unexpected EOF (end of file)!\n"); @@ -114,7 +114,7 @@ gnav_trl_read(void) } static void -gnav_trl_write_trkpt(const waypoint *wpt) +gnav_trl_write_trkpt(const waypoint* wpt) { gnav_trl_t rec; @@ -143,7 +143,7 @@ ff_vecs_t gnav_trl_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, gnav_trl_rd_init, diff --git a/gpsbabel/google.c b/gpsbabel/google.c index f0a012179..e23991315 100644 --- a/gpsbabel/google.c +++ b/gpsbabel/google.c @@ -19,11 +19,11 @@ #include "defs.h" #include "xmlgeneric.h" -static char *encoded_points = NULL; -static char *encoded_levels = NULL; -static char *script = NULL; -static route_head **routehead; -static int *routecount; +static char* encoded_points = NULL; +static char* encoded_levels = NULL; +static char* script = NULL; +static route_head** routehead; +static int* routecount; static short_handle desc_handle; static int serial = 0; @@ -33,7 +33,7 @@ static int serial = 0; #if ! HAVE_LIBEXPAT static void -google_rd_init(const char *fname) +google_rd_init(const char* fname) { fatal(MYNAME ": This build excluded Google Maps support because expat was not installed.\n"); } @@ -62,10 +62,10 @@ xg_tag_mapping google_map[] = { { goog_td_b, cb_cdata, "/div/div/table/tr/td/b" }, { goog_td_e, cb_end, "/div/table/tr/td" }, { goog_td_e, cb_end, "/div/div/table/tr/td" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; -void goog_script(const char *args, const char **unused) +void goog_script(const char* args, const char** unused) { if (args) { if (script) { @@ -76,7 +76,7 @@ void goog_script(const char *args, const char **unused) } } -void goog_points(const char *args, const char **unused) +void goog_points(const char* args, const char** unused) { if (args) { if (encoded_points) { @@ -87,7 +87,7 @@ void goog_points(const char *args, const char **unused) } } -void goog_levels(const char *args, const char **unused) +void goog_levels(const char* args, const char** unused) { if (args) { if (encoded_levels) { @@ -99,16 +99,16 @@ void goog_levels(const char *args, const char **unused) } static char goog_segname[7]; -static char *goog_realname = NULL; +static char* goog_realname = NULL; static int goog_segroute = 0; /* * The segments contain an index into the points array. We use that * index to find the waypoint and insert a better name for it. */ -void goog_segment_s(const char *args, const char **attrv) +void goog_segment_s(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (0 == strcmp(avp[0], "pointIndex")) { snprintf(goog_segname, sizeof(goog_segname), "\\%5.5x", atoi(avp[1])); @@ -118,9 +118,9 @@ void goog_segment_s(const char *args, const char **attrv) } -void goog_segment(const char *args, const char **unused) +void goog_segment(const char* args, const char** unused) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; wpt_tmp = route_find_waypt_by_name(routehead[goog_segroute], goog_segname); if (wpt_tmp) { @@ -130,9 +130,9 @@ void goog_segment(const char *args, const char **unused) } } -void goog_td_s(const char *args, const char **attrv) +void goog_td_s(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; int isdesc = 0; int isseg = 0; while (*avp) { @@ -158,18 +158,18 @@ void goog_td_s(const char *args, const char **attrv) } } -void goog_td_b(const char *args, const char **attrv) +void goog_td_b(const char* args, const char** attrv) { if (goog_segname[0] == '\\' && !strchr(args, '\xa0')) { if (goog_realname) { xfree(goog_realname); goog_realname = NULL; } - goog_realname = xmalloc(strlen(args)+1); + goog_realname = (char*) xmalloc(strlen(args)+1); strcpy(goog_realname, args); } } -void goog_td_e(const char *args, const char **attrv) +void goog_td_e(const char* args, const char** attrv) { if (goog_segname[0] == '\\' && goog_realname) { goog_segment(goog_realname, attrv); @@ -181,7 +181,7 @@ void goog_td_e(const char *args, const char **attrv) } } -static long decode_goog64(char **str) +static long decode_goog64(char** str) { long result = 0; unsigned char c = 0; @@ -203,15 +203,15 @@ static long decode_goog64(char **str) return result/2; } -void goog_poly_e(const char *args, const char **unused) +void goog_poly_e(const char* args, const char** unused) { long lat = 0; long lon = 0; long level = 0; long level1 = -9999; long level2 = -9999; - char *str = encoded_points; - char *lstr = encoded_levels; + char* str = encoded_points; + char* lstr = encoded_levels; routehead[goog_segroute] = route_head_alloc(); route_add_head(routehead[goog_segroute]); @@ -236,11 +236,11 @@ void goog_poly_e(const char *args, const char **unused) } { - waypoint *wpt_tmp = waypt_new(); + waypoint* wpt_tmp = waypt_new(); wpt_tmp->latitude = lat / 100000.0; wpt_tmp->longitude = lon / 100000.0; wpt_tmp->route_priority=level; - wpt_tmp->shortname = (char *) xmalloc(7); + wpt_tmp->shortname = (char*) xmalloc(7); sprintf(wpt_tmp->shortname, "\\%5.5x", serial++); route_add_wpt(routehead[goog_segroute], wpt_tmp); } @@ -249,7 +249,7 @@ void goog_poly_e(const char *args, const char **unused) } static void -google_rd_init(const char *fname) +google_rd_init(const char* fname) { desc_handle = mkshort_new_handle(); setshort_length(desc_handle, 12); @@ -260,8 +260,8 @@ google_rd_init(const char *fname) static void google_read(void) { - routehead = (route_head **)xmalloc(sizeof(route_head *)); - routecount = (int *)xmalloc(sizeof(int)); + routehead = (route_head**)xmalloc(sizeof(route_head*)); + routecount = (int*)xmalloc(sizeof(int)); goog_segroute = 0; xml_read(); xfree(routehead); @@ -276,14 +276,14 @@ google_read(void) encoded_levels = NULL; } if (script) { - char *xml = strchr(script, '\''); - char *dict = strstr(script, "({"); + char* xml = strchr(script, '\''); + char* dict = strstr(script, "({"); - char *end = NULL; + char* end = NULL; if (xml && (!dict || (xml < dict))) { - routehead = (route_head **)xmalloc(sizeof(route_head *)); - routecount = (int *)xmalloc(sizeof(int)); + routehead = (route_head**)xmalloc(sizeof(route_head*)); + routecount = (int*)xmalloc(sizeof(int)); goog_segroute = 0; xml++; end = strchr(xml+1, '\''); @@ -306,10 +306,10 @@ google_read(void) int ofs = 9; int panelofs = 8; int count = 0; - char *tmp = NULL; - char *start = NULL; + char* tmp = NULL; + char* start = NULL; - char *panel = strstr(dict, "panel: '"); + char* panel = strstr(dict, "panel: '"); encoded_points = strstr(dict, "points: '"); encoded_levels = strstr(dict, "levels: '"); if (!encoded_points) { @@ -331,7 +331,7 @@ google_read(void) tmp = panel; while (tmp) { if (qc == '"') { - char *tmp1 = strstr(tmp, "\"points\":\""); + char* tmp1 = strstr(tmp, "\"points\":\""); if (!tmp1) { tmp1 = strstr(tmp, "points:\""); } @@ -344,8 +344,8 @@ google_read(void) tmp++; } } - routehead = (route_head **)xmalloc(sizeof(route_head *)*count); - routecount = (int *)xmalloc(sizeof(int)*count); + routehead = (route_head**)xmalloc(sizeof(route_head*)*count); + routecount = (int*)xmalloc(sizeof(int)*count); goog_segroute = 0; do { @@ -412,8 +412,8 @@ google_read(void) } } if (end) { - char *to = panel; - char *from = panel; + char* to = panel; + char* from = panel; while (*from) { if (!strncmp(from, "\\\"", 2)) { *to++ = '"'; @@ -467,7 +467,7 @@ google_read(void) #if 0 { - FILE *foo = fopen("foo.xml", "w"); + FILE* foo = fopen("foo.xml", "w"); fprintf(foo, "\n", xhtml_entities); fwrite(panel, sizeof(char), strlen(panel), foo); fclose(foo); diff --git a/gpsbabel/gopal.c b/gpsbabel/gopal.c index 5a767442e..01fc35c8a 100644 --- a/gpsbabel/gopal.c +++ b/gpsbabel/gopal.c @@ -57,16 +57,16 @@ #include "grtcirc.h" #define MYNAME "gopal" -static gbfile *fin, *fout; +static gbfile* fin, *fout; static struct tm tm,filenamedate, trackdate; time_t tx; char tmp[64]; char routename[64]; -static char *optdate=NULL; -static char *optmaxspeed=NULL; -static char *optminspeed=NULL; -static char *optclean= NULL; +static char* optdate=NULL; +static char* optmaxspeed=NULL; +static char* optminspeed=NULL; +static char* optclean= NULL; static double minspeed,maxspeed; static struct tm opt_tm; /* converted "date" parameter */ static @@ -80,9 +80,9 @@ arglist_t gopal_args[] = { #define CHECK_BOOL(a) if (a && (*a == '0')) a = NULL -int gopal_check_line(char *line) +int gopal_check_line(char* line) { - char *c = line; + char* c = line; int i = 0; while ((c = strchr(c, ','))) { c++; @@ -98,11 +98,11 @@ int gopal_check_line(char *line) *******************************************************************************/ static void -gopal_rd_init(const char *fname) +gopal_rd_init(const char* fname) { char buff[32]; - char *ck; - char *filename; + char* ck; + char* filename; CHECK_BOOL(optclean); if (optminspeed) { minspeed=atof(optminspeed); @@ -130,7 +130,7 @@ gopal_rd_init(const char *fname) if (optdate) { memset(&opt_tm, 0, sizeof(opt_tm)); - ck = (char *)strptime(optdate, "%Y%m%d", &opt_tm); + ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm); if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) { fatal(MYNAME ": Invalid date \"%s\"!\n", optdate); } else if (opt_tm.tm_year < 70) { @@ -148,7 +148,7 @@ gopal_rd_init(const char *fname) strncpy(&buff[0],&filename[2],8); } // in buff we should now have something wich looks like a valid date starting with YYYYMMDD - ck = (char *)strptime(buff, "%Y%m%d", &filenamedate); + ck = (char*)strptime(buff, "%Y%m%d", &filenamedate); // if (((ck == NULL) || (*ck != '\0') )&&!(optdate)) // fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff); // /* else */ if (filenamedate.tm_year < 70) @@ -167,14 +167,14 @@ static void gopal_read(void) { - char *buff; - char *str, *c; + char* buff; + char* str, *c; int column; long line; double hmsd,speed; int fix, hms; - route_head *route; - waypoint *wpt, *lastwpt=NULL; + route_head* route; + waypoint* wpt, *lastwpt=NULL; double long_old,lat_old; char tbuffer[64]; struct tm tm2; @@ -333,18 +333,18 @@ gopal_read(void) } static void -gopal_route_hdr(const route_head *route) +gopal_route_hdr(const route_head* route) { } static void -gopal_route_tlr(const route_head *rte) +gopal_route_tlr(const route_head* rte) { } static void -gopal_write_waypt(const waypoint *wpt) +gopal_write_waypt(const waypoint* wpt) { char tbuffer[64]; unsigned long timestamp; @@ -373,7 +373,7 @@ gopal_write_waypt(const waypoint *wpt) static void -gopal_wr_init(const char *fname) +gopal_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); } @@ -404,7 +404,7 @@ ff_vecs_t gopal_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, gopal_rd_init, diff --git a/gpsbabel/gpilots.c b/gpsbabel/gpilots.c index 932d31a90..aabdf0bb9 100644 --- a/gpsbabel/gpilots.c +++ b/gpsbabel/gpilots.c @@ -142,10 +142,10 @@ struct record { }; -static pdbfile *file_in, *file_out; -static const char *out_fname; +static pdbfile* file_in, *file_out; +static const char* out_fname; static int ct = 0; -static char *dbname = NULL; +static char* dbname = NULL; static arglist_t my_args[] = { @@ -154,7 +154,7 @@ arglist_t my_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -170,7 +170,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -189,9 +189,9 @@ wr_deinit(void) static void data_read(void) { - struct record *rec; - pdbrec_t *pdb_rec; - route_head *track_head = NULL; + struct record* rec; + pdbrec_t* pdb_rec; + route_head* track_head = NULL; if (file_in->creator != MYCREATOR) { fatal(MYNAME ": Not a %s file.\n", MYNAME); @@ -209,9 +209,9 @@ data_read(void) } for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec=pdb_rec->next) { - waypoint *wpt_tmp; - Custom_Trk_Point_Type *tp_cust; - Compact_Trk_Point_Type *tp_comp; + waypoint* wpt_tmp; + Custom_Trk_Point_Type* tp_cust; + Compact_Trk_Point_Type* tp_comp; int lat; int lon; int sz; @@ -219,11 +219,11 @@ data_read(void) int trk_num = 0; int trk_seg_num = 1; char trk_seg_num_buf[10]; - char *trk_name = ""; + char* trk_name = ""; wpt_tmp = waypt_new(); - rec = (struct record *) pdb_rec->data; + rec = (struct record*) pdb_rec->data; switch (rec->header.type) { /* * G103Type @@ -278,7 +278,7 @@ data_read(void) */ switch (rec->wpt.CustTrkHdr.type) { case 102: - tp_cust = (Custom_Trk_Point_Type *)((char *) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr)); + tp_cust = (Custom_Trk_Point_Type*)((char*) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr)); while (sz--) { if ((int)(tp_cust->new_trk) == 1 || trk_seg_num == 1) { /* @@ -322,7 +322,7 @@ data_read(void) } break; case 104: - tp_comp = (Compact_Trk_Point_Type *)((char *) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr)); + tp_comp = (Compact_Trk_Point_Type*)((char*) pdb_rec->data + sizeof(rec->header) + sizeof(rec->wpt.CustTrkHdr)); while (sz--) { if ((int)(tp_comp->new_trk) == 1 || trk_seg_num == 1) { /* @@ -365,19 +365,19 @@ data_read(void) struct hdr { - char *wpt_name; - waypoint *wpt; + char* wpt_name; + waypoint* wpt; }; static void -my_write_wpt(const waypoint *wpt) +my_write_wpt(const waypoint* wpt) { - struct record *rec; - char *vdata; + struct record* rec; + char* vdata; int lat, lon; rec = xcalloc(sizeof *rec, 1); - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); rec->header.type = 4; rec->header.size = 5; @@ -390,7 +390,7 @@ my_write_wpt(const waypoint *wpt) le_write32(&rec->wpt.d103.lat, lat); le_write32(&rec->wpt.d103.lon, lon); - pdb_write_rec(file_out, 0, ct, ct+1, rec, (char *)vdata - (char *)rec); + pdb_write_rec(file_out, 0, ct, ct+1, rec, (char*)vdata - (char*)rec); ct++; xfree(rec); } diff --git a/gpsbabel/gpspilot.c b/gpsbabel/gpspilot.c index a53cdc477..c3dad5d8d 100644 --- a/gpsbabel/gpspilot.c +++ b/gpsbabel/gpspilot.c @@ -45,9 +45,9 @@ struct runways { pdb_32 en_latitude; /* similarly */ }; -static pdbfile *file_in, *file_out; -static const char *out_fname; -static char *dbname = NULL; +static pdbfile* file_in, *file_out; +static const char* out_fname; +static char* dbname = NULL; static int ct; static @@ -57,7 +57,7 @@ arglist_t gpspilot_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -73,7 +73,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); out_fname = fname; @@ -93,8 +93,8 @@ wr_deinit(void) static void data_read(void) { - struct record *rec; - pdbrec_t *pdb_rec; + struct record* rec; + pdbrec_t* pdb_rec; if ((file_in->creator != MYCREATOR)) { fatal(MYNAME ": Not a gpspilot file.\n"); @@ -112,18 +112,18 @@ data_read(void) } for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; - char *vdata; + waypoint* wpt_tmp; + char* vdata; wpt_tmp = waypt_new(); - rec = (struct record *) pdb_rec->data; + rec = (struct record*) pdb_rec->data; wpt_tmp->longitude = be_read32(&rec->longitude) / 3.6e6; wpt_tmp->latitude = be_read32(&rec->latitude) / 3.6e6; wpt_tmp->altitude = be_read16(&rec->elevation); - vdata = (char *) pdb_rec->data + sizeof(*rec); + vdata = (char*) pdb_rec->data + sizeof(*rec); /* * skip runway records if an airport. @@ -158,10 +158,10 @@ data_read(void) static void -gpspilot_writewpt(const waypoint *wpt) +gpspilot_writewpt(const waypoint* wpt) { - struct record *rec; - char *vdata; + struct record* rec; + char* vdata; rec = (struct record*) xcalloc(sizeof(*rec)+206,1); @@ -170,7 +170,7 @@ gpspilot_writewpt(const waypoint *wpt) be_write16(&rec->elevation, si_round(wpt->altitude)); be_write16(&rec->magvar, 0); - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); if (wpt->description) { strncpy(vdata, wpt->description, 36); vdata[35] = '\0'; @@ -194,7 +194,7 @@ gpspilot_writewpt(const waypoint *wpt) } vdata += strlen(vdata) + 1; - pdb_write_rec(file_out, 0, 2, ct++, (void *)rec, (char *)vdata - (char *)rec); + pdb_write_rec(file_out, 0, 2, ct++, (void*)rec, (char*)vdata - (char*)rec); xfree(rec); } diff --git a/gpsbabel/gpssim.c b/gpsbabel/gpssim.c index 7afd46060..618463e7e 100644 --- a/gpsbabel/gpssim.c +++ b/gpsbabel/gpssim.c @@ -23,11 +23,11 @@ #define MYNAME "gpssim" -static gbfile *fout; -static char *wayptspd; -static char *splitfiles_opt; +static gbfile* fout; +static char* wayptspd; +static char* splitfiles_opt; static int splitfiles; -static char *fnamestr; +static char* fnamestr; static int trk_count; static int doing_tracks; @@ -52,7 +52,7 @@ arglist_t gpssim_args[] = { */ static void -gpssim_wr_init(const char *fname) +gpssim_wr_init(const char* fname) { fnamestr = xstrdup(fname); trk_count = 0; @@ -86,7 +86,7 @@ gpssim_wr_deinit(void) */ static void -gpssim_write_sentence(const char *const s) +gpssim_write_sentence(const char* const s) { gbfprintf(fout, "$%s*%02X\r\n", s, nmea_cksum(s)); } @@ -101,7 +101,7 @@ gpssim_write_spd(double knotsperhour) } static void -gpssim_write_pt(const waypoint *wpt) +gpssim_write_pt(const waypoint* wpt) { char obuf[1024]; double lat, lon; @@ -122,7 +122,7 @@ gpssim_write_pt(const waypoint *wpt) if (wpt->creation_time) { char tbuf[20]; int hms, ymd; - struct tm *tm; + struct tm* tm; tm = gmtime(&wpt->creation_time); hms = tm->tm_hour * 10000 + tm->tm_min * 100 + tm->tm_sec; @@ -135,11 +135,11 @@ gpssim_write_pt(const waypoint *wpt) } static void -gpssim_trk_hdr(const route_head *rh) +gpssim_trk_hdr(const route_head* rh) { if (splitfiles) { char c[1024]; - char *ofname = xstrdup(fnamestr); + char* ofname = xstrdup(fnamestr); if (fout) { fatal(MYNAME ": output file already open.\n"); @@ -156,7 +156,7 @@ gpssim_trk_hdr(const route_head *rh) } static void -gpssim_trk_ftr(const route_head *rh) +gpssim_trk_ftr(const route_head* rh) { if (splitfiles) { gbfclose(fout); @@ -169,7 +169,7 @@ gpssim_write(void) { if (waypt_count()) { if (splitfiles) { - char *ofname = xstrdup(fnamestr); + char* ofname = xstrdup(fnamestr); ofname = xstrappend(ofname, "-waypoints.gpssim"); fout = gbfopen(ofname, "wb", MYNAME); xfree(ofname); diff --git a/gpsbabel/gpsutil.c b/gpsbabel/gpsutil.c index 8b9b1eca6..0fae24e9b 100644 --- a/gpsbabel/gpsutil.c +++ b/gpsbabel/gpsutil.c @@ -21,13 +21,13 @@ #include "defs.h" #include "magellan.h" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static short_handle mkshort_handle; #define MYNAME "GPSUTIL" static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); } @@ -39,7 +39,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -55,7 +55,7 @@ wr_deinit(void) static void data_read(void) { - char *ibuf; + char* ibuf; char desc[31]; double lat,lon; char latdir, londir; @@ -63,7 +63,7 @@ data_read(void) long alt; char alttype; char icon[3]; - waypoint *wpt_tmp; + waypoint* wpt_tmp; int line = 0; /* * Make sure that all waypoints in single read have same @@ -74,7 +74,7 @@ data_read(void) while ((ibuf = gbfgetstr(file_in))) { int n, len; - char *sn; + char* sn; if ((line++ == 0) && file_in->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -132,11 +132,11 @@ data_read(void) } static void -gpsutil_disp(const waypoint *wpt) +gpsutil_disp(const waypoint* wpt) { double lon,lat; - const char *icon_token; - char *tdesc = xstrdup(wpt->description); + const char* icon_token; + char* tdesc = xstrdup(wpt->description); icon_token = mag_find_token_from_descr(wpt->icon_descr); diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 834654d1d..aa4c4fb94 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -29,48 +29,48 @@ static XML_Parser psr; #endif -static xml_tag *cur_tag; +static xml_tag* cur_tag; static vmem_t cdatastr; -static char *opt_logpoint = NULL; -static char *opt_humminbirdext = NULL; -static char *opt_garminext = NULL; +static char* opt_logpoint = NULL; +static char* opt_humminbirdext = NULL; +static char* opt_garminext = NULL; static int logpoint_ct = 0; -static const char *gpx_version; -static char *gpx_wversion; +static const char* gpx_version; +static char* gpx_wversion; static int gpx_wversion_num; -static const char *gpx_creator; -static char *xsi_schema_loc = NULL; +static const char* gpx_creator; +static char* xsi_schema_loc = NULL; -static char *gpx_email = NULL; -static char *gpx_author = NULL; +static char* gpx_email = NULL; +static char* gpx_author = NULL; static vmem_t current_tag; -static waypoint *wpt_tmp; +static waypoint* wpt_tmp; static int cache_descr_is_html; -static gbfile *fd; -static const char *input_fname; -static gbfile *ofd; +static gbfile* fd; +static const char* input_fname; +static gbfile* ofd; static short_handle mkshort_handle; -static const char *link_url; -static char *link_text; +static const char* link_url; +static char* link_text; -static const char *input_string = NULL; +static const char* input_string = NULL; static int input_string_len = 0; static time_t file_time; -static char *snlen = NULL; -static char *suppresswhite = NULL; -static char *urlbase = NULL; -static route_head *trk_head; -static route_head *rte_head; -static const route_head *current_trk_head; // Output. +static char* snlen = NULL; +static char* suppresswhite = NULL; +static char* urlbase = NULL; +static route_head* trk_head; +static route_head* rte_head; +static const route_head* current_trk_head; // Output. /* used for bounds calculation on output */ static bounds all_bounds; static int next_trkpt_is_new_seg; -static format_specific_data **fs_ptr; +static format_specific_data** fs_ptr; #define MYNAME "GPX" #define MY_CBUF_SZ 4096 @@ -191,7 +191,7 @@ typedef enum { typedef struct { struct queue queue; - char *tagdata; + char* tagdata; } gpx_global_entry; /* @@ -207,13 +207,13 @@ struct gpx_global { gpx_global_entry urlname; gpx_global_entry keywords; /* time and bounds aren't here; they're recomputed. */ -} *gpx_global ; +}* gpx_global ; static void -gpx_add_to_global(gpx_global_entry *ge, char *cdata) +gpx_add_to_global(gpx_global_entry* ge, char* cdata) { - queue *elem, *tmp; - gpx_global_entry * gep; + queue* elem, *tmp; + gpx_global_entry* gep; QUEUE_FOR_EACH(&ge->queue, elem, tmp) { gep = BASE_STRUCT(elem, gpx_global_entry, queue); @@ -229,22 +229,22 @@ gpx_add_to_global(gpx_global_entry *ge, char *cdata) } static void -gpx_rm_from_global(gpx_global_entry *ge) +gpx_rm_from_global(gpx_global_entry* ge) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&ge->queue, elem, tmp) { - gpx_global_entry *g = (gpx_global_entry *) dequeue(elem); + gpx_global_entry* g = (gpx_global_entry*) dequeue(elem); xfree(g->tagdata); xfree(g); } } static void -gpx_write_gdata(gpx_global_entry *ge, const char *tag) +gpx_write_gdata(gpx_global_entry* ge, const char* tag) { - queue *elem, *tmp; - gpx_global_entry * gep; + queue* elem, *tmp; + gpx_global_entry* gep; if (!gpx_global || QUEUE_EMPTY(&ge->queue)) { return; @@ -268,7 +268,7 @@ gpx_write_gdata(gpx_global_entry *ge, const char *tag) typedef struct tag_mapping { tag_type tag_type_; /* enum from above for this tag */ int tag_passthrough; /* true if we don't generate this */ - const char *tag_name; /* xpath-ish tag name */ + const char* tag_name; /* xpath-ish tag name */ unsigned long crc; /* Crc32 of tag_name */ } tag_mapping; @@ -408,9 +408,9 @@ tag_mapping tag_path_map[] = { }; static tag_type -get_tag(const char *t, int *passthrough) +get_tag(const char* t, int* passthrough) { - tag_mapping *tm; + tag_mapping* tm; unsigned long tcrc = get_crc32_s(t); for (tm = tag_path_map; tm->tag_type_ != 0; tm++) { @@ -426,16 +426,16 @@ get_tag(const char *t, int *passthrough) static void prescan_tags(void) { - tag_mapping *tm; + tag_mapping* tm; for (tm = tag_path_map; tm->tag_type_ != 0; tm++) { tm->crc = get_crc32_s(tm->tag_name); } } static void -tag_gpx(const char **attrv) +tag_gpx(const char** attrv) { - const char **avp; + const char** avp; for (avp = &attrv[0]; *avp; avp += 2) { if (strcmp(avp[0], "version") == 0) { gpx_version = avp[1]; @@ -465,9 +465,9 @@ tag_gpx(const char **attrv) } static void -tag_wpt(const char **attrv) +tag_wpt(const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; wpt_tmp = waypt_new(); @@ -486,9 +486,9 @@ tag_wpt(const char **attrv) } static void -tag_cache_desc(const char ** attrv) +tag_cache_desc(const char** attrv) { - const char **avp; + const char** avp; cache_descr_is_html = 0; for (avp = &attrv[0]; *avp; avp+=2) { @@ -501,10 +501,10 @@ tag_cache_desc(const char ** attrv) } static void -tag_gs_cache(const char **attrv) +tag_gs_cache(const char** attrv) { - const char **avp; - geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp); + const char** avp; + geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); for (avp = &attrv[0]; *avp; avp+=2) { if (strcmp(avp[0], "id") == 0) { @@ -526,19 +526,19 @@ tag_gs_cache(const char **attrv) } static void -start_something_else(const char *el, const char **attrv) +start_something_else(const char* el, const char** attrv) { - const char **avp = attrv; - char **avcp = NULL; + const char** avp = attrv; + char** avcp = NULL; int attr_count = 0; - xml_tag *new_tag; - fs_xml *fs_gpx; + xml_tag* new_tag; + fs_xml* fs_gpx; if (!fs_ptr) { return; } - new_tag = (xml_tag *)xcalloc(sizeof(xml_tag),1); + new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1); new_tag->tagname = xstrdup(el); /* count attributes */ @@ -549,7 +549,7 @@ start_something_else(const char *el, const char **attrv) /* copy attributes */ avp = attrv; - new_tag->attributes = (char **)xcalloc(sizeof(char *),attr_count+1); + new_tag->attributes = (char**)xcalloc(sizeof(char*),attr_count+1); avcp = new_tag->attributes; while (*avp) { *avcp = xstrdup(*avp); @@ -571,7 +571,7 @@ start_something_else(const char *el, const char **attrv) new_tag->parent = cur_tag; } } else { - fs_gpx = (fs_xml *)fs_chain_find(*fs_ptr, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX); if (fs_gpx && fs_gpx->tag) { cur_tag = fs_gpx->tag; @@ -583,7 +583,7 @@ start_something_else(const char *el, const char **attrv) } else { fs_gpx = fs_xml_alloc(FS_GPX); fs_gpx->tag = new_tag; - fs_chain_add(fs_ptr, (format_specific_data *)fs_gpx); + fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx); new_tag->parent = NULL; } } @@ -599,10 +599,10 @@ end_something_else() } static void -tag_log_wpt(const char **attrv) +tag_log_wpt(const char** attrv) { - waypoint * lwp_tmp; - const char **avp = &attrv[0]; + waypoint* lwp_tmp; + const char** avp = &attrv[0]; /* create a new waypoint */ lwp_tmp = waypt_new(); @@ -627,7 +627,7 @@ tag_log_wpt(const char **attrv) if ((wpt_tmp->shortname) && (strlen(wpt_tmp->shortname) > 2)) { /* copy of the shortname */ - lwp_tmp->shortname = (char *) xcalloc(7, 1); + lwp_tmp->shortname = (char*) xcalloc(7, 1); sprintf(lwp_tmp->shortname, "%-4.4s%02d", &wpt_tmp->shortname[2], logpoint_ct++); @@ -636,14 +636,14 @@ tag_log_wpt(const char **attrv) } static void -gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) +gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) { - char *e; - char *ep; + char* e; + char* ep; int passthrough; int tag; - const char *el = xml_convert_to_char_string(xml_el); - const char **attr = xml_convert_attrs_to_char_string(xml_attr); + const char* el = xml_convert_to_char_string(xml_el); + const char** attr = xml_convert_attrs_to_char_string(xml_attr); vmem_realloc(¤t_tag, strlen(current_tag.mem) + 2 + strlen(el)); e = current_tag.mem; @@ -655,7 +655,7 @@ gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) /* * Reset end-of-string without actually emptying/reallocing cdatastr. */ - *(char *) cdatastr.mem = 0; + *(char*) cdatastr.mem = 0; tag = get_tag(current_tag.mem, &passthrough); switch (tag) { @@ -725,7 +725,7 @@ gpx_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) struct gs_type_mapping { geocache_type type; - const char *name; + const char* name; } gs_type_map[] = { { gt_traditional, "Traditional Cache" }, { gt_traditional, "Traditional" }, /* opencaching.de */ @@ -753,7 +753,7 @@ struct struct gs_container_mapping { geocache_container type; - const char *name; + const char* name; } gs_container_map[] = { { gc_other, "Unknown" }, { gc_other, "Other" }, /* Synonym on read. */ @@ -765,7 +765,7 @@ struct }; geocache_type -gs_mktype(const char *t) +gs_mktype(const char* t) { int i; int sz = sizeof(gs_type_map) / sizeof(gs_type_map[0]); @@ -778,7 +778,7 @@ gs_mktype(const char *t) return gt_unknown; } -const char * +const char* gs_get_cachetype(geocache_type t) { int i; @@ -793,7 +793,7 @@ gs_get_cachetype(geocache_type t) } geocache_container -gs_mkcont(const char *t) +gs_mkcont(const char* t) { int i; int sz = sizeof(gs_container_map) / sizeof(gs_container_map[0]); @@ -806,7 +806,7 @@ gs_mkcont(const char *t) return gc_unknown; } -const char * +const char* gs_get_container(geocache_container t) { int i; @@ -821,16 +821,16 @@ gs_get_container(geocache_container t) } time_t -xml_parse_time(const char *cdatastr, int *microsecs) +xml_parse_time(const char* cdatastr, int* microsecs) { int off_hr = 0; int off_min = 0; int off_sign = 1; - char *offsetstr = NULL; - char *pointstr = NULL; + char* offsetstr = NULL; + char* pointstr = NULL; struct tm tm; time_t rv = 0; - char *timestr = xstrdup(cdatastr); + char* timestr = xstrdup(cdatastr); memset(&tm, 0, sizeof(tm)); @@ -889,12 +889,12 @@ xml_parse_time(const char *cdatastr, int *microsecs) } static void -gpx_end(void *data, const XML_Char *xml_el) +gpx_end(void* data, const XML_Char* xml_el) { - const char *el = xml_convert_to_char_string(xml_el); - char *s = strrchr(current_tag.mem, '/'); + const char* el = xml_convert_to_char_string(xml_el); + char* s = strrchr(current_tag.mem, '/'); float x; - char *cdatastrp = cdatastr.mem; + char* cdatastrp = cdatastr.mem; int passthrough; static time_t gc_log_date; tag_type tag; @@ -967,7 +967,7 @@ gpx_end(void *data, const XML_Char *xml_el) case tt_cache_desc_long: rtrim(cdatastrp); if (cdatastrp[0]) { - geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp); + geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); gc_data->desc_long.is_html = cache_descr_is_html; gc_data->desc_long.utfstring = xstrdup(cdatastrp); } @@ -975,7 +975,7 @@ gpx_end(void *data, const XML_Char *xml_el) case tt_cache_desc_short: rtrim(cdatastrp); if (cdatastrp[0]) { - geocache_data *gc_data = waypt_alloc_gc_data(wpt_tmp); + geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); gc_data->desc_short.is_html = cache_descr_is_html; gc_data->desc_short.utfstring = xstrdup(cdatastrp); } @@ -1156,7 +1156,7 @@ gpx_end(void *data, const XML_Char *xml_el) //TODO: implement GPX 1.1 case tt_trk_trkseg_trkpt_link: //TODO: implement GPX 1.1 case tt_rte_rtept_link: { - char *lt = link_text; + char* lt = link_text; if (lt) { lt = xstrdup(lrtrim(link_text)); } @@ -1183,7 +1183,7 @@ gpx_end(void *data, const XML_Char *xml_el) #if ! HAVE_LIBEXPAT static void -gpx_rd_init(const char *fname) +gpx_rd_init(const char* fname) { fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n"); } @@ -1196,17 +1196,17 @@ gpx_rd_deinit(void) #else /* NO_EXPAT */ static void -gpx_cdata(void *dta, const XML_Char *xml_el, int len) +gpx_cdata(void* dta, const XML_Char* xml_el, int len) { - char *estr; - int *cdatalen; - char **cdata; - xml_tag *tmp_tag; + char* estr; + int* cdatalen; + char** cdata; + xml_tag* tmp_tag; size_t slen = strlen(cdatastr.mem); - const char *s = xml_convert_to_char_string_n(xml_el, &len); + const char* s = xml_convert_to_char_string_n(xml_el, &len); vmem_realloc(&cdatastr, 1 + len + slen); - estr = ((char *) cdatastr.mem) + slen; + estr = ((char*) cdatastr.mem) + slen; memcpy(estr, s, len); estr[len] = 0; @@ -1236,7 +1236,7 @@ gpx_cdata(void *dta, const XML_Char *xml_el, int len) } static void -gpx_rd_init(const char *fname) +gpx_rd_init(const char* fname) { if (fname[0]) { fd = gbfopen(fname, "r", MYNAME); @@ -1251,7 +1251,7 @@ gpx_rd_init(const char *fname) file_time = 0; current_tag = vmem_alloc(1, 0); - *((char *)current_tag.mem) = '\0'; + *((char*)current_tag.mem) = '\0'; prescan_tags(); @@ -1262,7 +1262,7 @@ gpx_rd_init(const char *fname) XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); cdatastr = vmem_alloc(1, 0); - *((char *)cdatastr.mem) = '\0'; + *((char*)cdatastr.mem) = '\0'; if (!xsi_schema_loc) { xsi_schema_loc = xstrdup(DEFAULT_XSI_SCHEMA_LOC); @@ -1327,7 +1327,7 @@ gpx_rd_deinit(void) #endif static void -gpx_wr_init(const char *fname) +gpx_wr_init(const char* fname) { mkshort_handle = mkshort_new_handle(); @@ -1347,7 +1347,7 @@ gpx_read(void) #if HAVE_LIBEXPAT int len; int done = 0; - char *buf = (char*) xmalloc(MY_CBUF_SZ); + char* buf = (char*) xmalloc(MY_CBUF_SZ); int result = 0; int extra; @@ -1366,8 +1366,8 @@ gpx_read(void) * we find it, strip it, then read byte-at-a-time * until we find a non-entity. */ - char *badchar; - char *semi; + char* badchar; + char* semi; int maxentlength = 8; len = gbfread(buf, 1, MY_CBUF_SZ - maxentlength, fd); done = gbfeof(fd) || !len; @@ -1395,7 +1395,7 @@ gpx_read(void) badchar = strstr(buf, "&#x"); while (badchar) { int val = 0; - char *hexit = badchar+3; + char* hexit = badchar+3; semi = strchr(badchar, ';'); if (semi) { while (*hexit && *hexit != ';') { @@ -1437,9 +1437,9 @@ gpx_read(void) } static void -fprint_tag_and_attrs(const char *prefix, const char *suffix, xml_tag *tag) +fprint_tag_and_attrs(const char* prefix, const char* suffix, xml_tag* tag) { - char **pa; + char** pa; gbfprintf(ofd, "%s%s", prefix, tag->tagname); pa = tag->attributes; if (pa) { @@ -1452,9 +1452,9 @@ fprint_tag_and_attrs(const char *prefix, const char *suffix, xml_tag *tag) } static void -fprint_xml_chain(xml_tag *tag, const waypoint *wpt) +fprint_xml_chain(xml_tag* tag, const waypoint* wpt) { - char *tmp_ent; + char* tmp_ent; while (tag) { if (!tag->cdata && !tag->child) { fprint_tag_and_attrs("<", " />", tag); @@ -1485,10 +1485,10 @@ fprint_xml_chain(xml_tag *tag, const waypoint *wpt) } } -void free_gpx_extras(xml_tag *tag) +void free_gpx_extras(xml_tag* tag) { - xml_tag *next = NULL; - char **ap; + xml_tag* next = NULL; + char** ap; while (tag) { if (tag->cdata) { @@ -1523,17 +1523,17 @@ void free_gpx_extras(xml_tag *tag) * Handle the grossness of GPX 1.0 vs. 1.1 handling of linky links. */ static void -write_gpx_url(const waypoint *waypointp) +write_gpx_url(const waypoint* waypointp) { - char *tmp_ent; + char* tmp_ent; if (waypointp->url == NULL) { return; } if (gpx_wversion_num > 10) { - url_link *tail; - for (tail = (url_link *)&waypointp->url_next; tail; tail = tail->url_next) { + url_link* tail; + for (tail = (url_link*)&waypointp->url_next; tail; tail = tail->url_next) { tmp_ent = xml_entitize(tail->url); gbfprintf(ofd, " \n", urlbase ? urlbase : "", tmp_ent); @@ -1558,9 +1558,9 @@ write_gpx_url(const waypoint *waypointp) * Order counts. */ static void -gpx_write_common_acc(const waypoint *waypointp, const char *indent) +gpx_write_common_acc(const waypoint* waypointp, const char* indent) { - const char *fix = NULL; + const char* fix = NULL; switch (waypointp->fix) { case fix_2d: @@ -1602,7 +1602,7 @@ gpx_write_common_acc(const waypoint *waypointp, const char *indent) static void -gpx_write_common_position(const waypoint *waypointp, const char *indent) +gpx_write_common_position(const waypoint* waypointp, const char* indent) { if (waypointp->altitude != unknown_alt) { gbfprintf(ofd, "%s%f\n", @@ -1615,7 +1615,7 @@ gpx_write_common_position(const waypoint *waypointp, const char *indent) } static void -gpx_write_common_extensions(const waypoint *waypointp, const char *indent) +gpx_write_common_extensions(const waypoint* waypointp, const char* indent) { if (((opt_humminbirdext || opt_garminext) && (waypointp->depth != 0 || waypointp->temperature != 0)) || (opt_garminext && (waypointp->heartrate != 0 || waypointp->cadence != 0))) { @@ -1651,8 +1651,8 @@ gpx_write_common_extensions(const waypoint *waypointp, const char *indent) } static void -gpx_write_common_description(const waypoint *waypointp, const char *indent, - const char *oname) +gpx_write_common_description(const waypoint* waypointp, const char* indent, + const char* oname) { write_optional_xml_entity(ofd, indent, "name", oname); write_optional_xml_entity(ofd, indent, "cmt", waypointp->description); @@ -1666,12 +1666,12 @@ gpx_write_common_description(const waypoint *waypointp, const char *indent, } static void -gpx_waypt_pr(const waypoint *waypointp) +gpx_waypt_pr(const waypoint* waypointp) { - const char *oname; - char *odesc; - fs_xml *fs_gpx; - garmin_fs_t *gmsd; /* gARmIN sPECIAL dATA */ + const char* oname; + char* odesc; + fs_xml* fs_gpx; + garmin_fs_t* gmsd; /* gARmIN sPECIAL dATA */ /* * Desparation time, try very hard to get a good shortname @@ -1696,7 +1696,7 @@ gpx_waypt_pr(const waypoint *waypointp) gpx_write_common_description(waypointp, " ", oname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); gmsd = GMSD_FIND(waypointp); if (fs_gpx) { if (! gmsd) { @@ -1712,9 +1712,9 @@ gpx_waypt_pr(const waypoint *waypointp) } static void -gpx_track_hdr(const route_head *rte) +gpx_track_hdr(const route_head* rte) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; current_trk_head = rte; gbfprintf(ofd, "\n"); @@ -1725,7 +1725,7 @@ gpx_track_hdr(const route_head *rte) } if (gpx_wversion_num > 10) { - fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, NULL); } @@ -1734,9 +1734,9 @@ gpx_track_hdr(const route_head *rte) } static void -gpx_track_disp(const waypoint *waypointp) +gpx_track_disp(const waypoint* waypointp) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; int first_in_trk; first_in_trk = waypointp->Q.prev == ¤t_trk_head->waypoint_list; @@ -1773,7 +1773,7 @@ gpx_track_disp(const waypoint *waypointp) NULL : waypointp->shortname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } @@ -1783,7 +1783,7 @@ gpx_track_disp(const waypoint *waypointp) } static void -gpx_track_tlr(const route_head *rte) +gpx_track_tlr(const route_head* rte) { if (!QUEUE_EMPTY(¤t_trk_head->waypoint_list)) { gbfprintf(ofd, "\n"); @@ -1799,9 +1799,9 @@ void gpx_track_pr() } static void -gpx_route_hdr(const route_head *rte) +gpx_route_hdr(const route_head* rte) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, "\n"); write_optional_xml_entity(ofd, " ", "name", rte->rte_name); @@ -1811,7 +1811,7 @@ gpx_route_hdr(const route_head *rte) } if (gpx_wversion_num > 10) { - fs_gpx = (fs_xml *)fs_chain_find(rte->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, NULL); } @@ -1819,9 +1819,9 @@ gpx_route_hdr(const route_head *rte) } static void -gpx_route_disp(const waypoint *waypointp) +gpx_route_disp(const waypoint* waypointp) { - fs_xml *fs_gpx; + fs_xml* fs_gpx; gbfprintf(ofd, " \n", waypointp->latitude, @@ -1831,7 +1831,7 @@ gpx_route_disp(const waypoint *waypointp) gpx_write_common_description(waypointp, " ", waypointp->shortname); gpx_write_common_acc(waypointp, " "); - fs_gpx = (fs_xml *)fs_chain_find(waypointp->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } @@ -1841,7 +1841,7 @@ gpx_route_disp(const waypoint *waypointp) } static void -gpx_route_tlr(const route_head *rte) +gpx_route_tlr(const route_head* rte) { gbfprintf(ofd, "\n"); } @@ -1854,7 +1854,7 @@ void gpx_route_pr() } static void -gpx_waypt_bound_calc(const waypoint *waypointp) +gpx_waypt_bound_calc(const waypoint* waypointp) { waypt_add_to_bounds(&all_bounds, waypointp); } @@ -1883,7 +1883,7 @@ gpx_write(void) int short_length; if (opt_humminbirdext || opt_garminext) { - gpx_wversion = (char *)"1.1"; + gpx_wversion = (char*)"1.1"; } gpx_wversion_num = strtod(gpx_wversion, NULL) * 10; diff --git a/gpsbabel/grtcirc.c b/gpsbabel/grtcirc.c index 70f534e3a..4be866261 100644 --- a/gpsbabel/grtcirc.c +++ b/gpsbabel/grtcirc.c @@ -27,7 +27,7 @@ static const double EARTH_RAD = 6378137.0; static void crossproduct(double x1, double y1, double z1, double x2, double y2, double z2, - double *xa, double *ya, double *za) + double* xa, double* ya, double* za) { *xa = y1*z2-y2*z1; *ya = z1*x2-z2*x1; @@ -290,7 +290,7 @@ double linedist(double lat1, double lon1, void linepart(double lat1, double lon1, double lat2, double lon2, double frac, - double *reslat, double *reslon) + double* reslat, double* reslon) { double x1,y1,z1; diff --git a/gpsbabel/grtcirc.h b/gpsbabel/grtcirc.h index 791fc4110..ff402cf00 100644 --- a/gpsbabel/grtcirc.h +++ b/gpsbabel/grtcirc.h @@ -36,7 +36,7 @@ double radtomiles(double rads); void linepart(double lat1, double lon1, double lat2, double lon2, double frac, - double *reslat, double *reslon); + double* reslat, double* reslon); /* Degrees to radians */ #define DEG(x) ((x)*180.0/M_PI) diff --git a/gpsbabel/gtm.c b/gpsbabel/gtm.c index 4a23fa6ac..916b2dbf0 100644 --- a/gpsbabel/gtm.c +++ b/gpsbabel/gtm.c @@ -21,7 +21,7 @@ #include "defs.h" #include "jeeps/gpsmath.h" -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static int indatum; static int wp_count; static int ws_count; @@ -29,7 +29,7 @@ static int tr_count; static int ts_count; static int rt_count; static int im_count; -static const route_head *rte_active; +static const route_head* rte_active; static int start_new; #define MYNAME "GTM" @@ -55,7 +55,7 @@ static int start_new; #if 0 /* not used */ static short int -fread_bool(gbfile *fd) +fread_bool(gbfile* fd) { char buf[2]; gbfread(buf, 2, 1, fd); @@ -68,17 +68,17 @@ fread_bool(gbfile *fd) #define fread_single(a) gbfgetflt(a) #define fread_double(a) gbfgetdbl(a) -static char * -fread_string(gbfile *fd) +static char* +fread_string(gbfile* fd) { - char *val; + char* val; int len = fread_integer(fd); if (len == 0) { return NULL; } - val = (char *) xmalloc(len+1); + val = (char*) xmalloc(len+1); gbfread(val, 1, len, fd); while (len != 0 && val[len-1] == ' ') { len--; @@ -88,19 +88,19 @@ fread_string(gbfile *fd) } static void -fread_string_discard(gbfile *fd) +fread_string_discard(gbfile* fd) { - char *temp = fread_string(fd); + char* temp = fread_string(fd); if (temp != NULL) { xfree(temp); } } -static char * -fread_fixedstring(gbfile *fd, int len) +static char* +fread_fixedstring(gbfile* fd, int len) { - char *val = (char *) xmalloc(len+1); + char* val = (char*) xmalloc(len+1); gbfread(val, 1, len, fd); while (len != 0 && val[len-1] == ' ') { @@ -113,7 +113,7 @@ fread_fixedstring(gbfile *fd, int len) /* Write functions, according to specification. */ static void -fwrite_null(gbfile *fd, int len) +fwrite_null(gbfile* fd, int len) { char buf[1024]; @@ -129,7 +129,7 @@ fwrite_null(gbfile *fd, int len) #define fwrite_double(a,b) gbfputdbl((b), a) static void -fwrite_string(gbfile *fd, const char *str) +fwrite_string(gbfile* fd, const char* str) { if (str && str[0]) { int len = strlen(str); @@ -141,7 +141,7 @@ fwrite_string(gbfile *fd, const char *str) } void -fwrite_fixedstring(gbfile *fd, const char *str, int fieldlen) +fwrite_fixedstring(gbfile* fd, const char* str, int fieldlen) { int len = str ? strlen(str) : 0; @@ -415,7 +415,7 @@ set_datum(int n) } } -static const char *icon_descr[] = { +static const char* icon_descr[] = { "", "Airport", "Ball Park", "Bank", "Bar", "Boat Ramp", "Campground", "Car", "City (Large)", "City (Medium)", "City (Small)", "Dam", "Danger Area", "Drinking Water", "Fishing Area", "Gas Station", "Glider Area", "Golf Course", @@ -460,7 +460,7 @@ static const char *icon_descr[] = { }; -void convert_datum(double *lat, double *lon) +void convert_datum(double* lat, double* lon) { double amt; if (indatum != -1 && indatum != 118) { @@ -472,10 +472,10 @@ void convert_datum(double *lat, double *lon) /* Callbacks */ static void -gtm_rd_init(const char *fname) +gtm_rd_init(const char* fname) { int version; - char *name; + char* name; file_in = gbfopen_le(fname, "rb", MYNAME); version = fread_integer(file_in); name = fread_fixedstring(file_in, 10); @@ -518,17 +518,17 @@ gtm_rd_deinit(void) gbfclose(file_in); } -static void count_route_waypts(const waypoint *wpt) +static void count_route_waypts(const waypoint* wpt) { rt_count++; } -static void count_track_waypts(const waypoint *wpt) +static void count_track_waypts(const waypoint* wpt) { tr_count++; } static void -gtm_wr_init(const char *fname) +gtm_wr_init(const char* fname) { rt_count = tr_count = 0; track_disp_all(NULL, NULL, count_track_waypts); @@ -591,12 +591,12 @@ gtm_wr_deinit(void) static void gtm_read(void) { - route_head *first_trk_head = NULL; - route_head *trk_head = NULL; - route_head *rte_head = NULL; - waypoint *wpt; + route_head* first_trk_head = NULL; + route_head* trk_head = NULL; + route_head* rte_head = NULL; + waypoint* wpt; int real_tr_count = 0; - char *route_name; + char* route_name; unsigned int icon; int i; @@ -673,7 +673,7 @@ gtm_read(void) for (i = 0; i != ts_count && i != real_tr_count; i++) { trk_head->rte_name = fread_string(file_in); fread_discard(file_in, 12); - trk_head = (route_head *)QUEUE_NEXT(&trk_head->Q); + trk_head = (route_head*)QUEUE_NEXT(&trk_head->Q); } /* Routes */ @@ -709,7 +709,7 @@ gtm_read(void) } } -int icon_from_descr(const char *descr) +int icon_from_descr(const char* descr) { if (descr) { int i; @@ -721,7 +721,7 @@ int icon_from_descr(const char *descr) return 48; } -static void write_waypt(const waypoint *wpt) +static void write_waypt(const waypoint* wpt) { fwrite_double(file_out, wpt->latitude); fwrite_double(file_out, wpt->longitude); @@ -743,13 +743,13 @@ static void write_waypt(const waypoint *wpt) fwrite_integer(file_out, 0); } -static void start_rte(const route_head *rte) +static void start_rte(const route_head* rte) { rte_active = rte; start_new = 1; } -static void write_trk_waypt(const waypoint *wpt) +static void write_trk_waypt(const waypoint* wpt) { fwrite_double(file_out, wpt->latitude); fwrite_double(file_out, wpt->longitude); @@ -763,7 +763,7 @@ static void write_trk_waypt(const waypoint *wpt) start_new = 0; } -static void write_trk_style(const route_head *trk) +static void write_trk_style(const route_head* trk) { fwrite_string(file_out, trk->rte_name); fwrite_byte(file_out, 1); @@ -773,7 +773,7 @@ static void write_trk_style(const route_head *trk) fwrite_integer(file_out, 0); } -static void write_rte_waypt(const waypoint *wpt) +static void write_rte_waypt(const waypoint* wpt) { fwrite_double(file_out, wpt->latitude); fwrite_double(file_out, wpt->longitude); diff --git a/gpsbabel/gtrnctr.c b/gpsbabel/gtrnctr.c index bd292f808..f5188279d 100644 --- a/gpsbabel/gtrnctr.c +++ b/gpsbabel/gtrnctr.c @@ -22,12 +22,12 @@ #include "defs.h" #include "xmlgeneric.h" -static gbfile *ofd; +static gbfile* ofd; static int lap_ct = 0; static int lap_s = 0; -static waypoint *wpt_tmp; -static route_head *trk_head; -static computed_trkdata *tdata; +static waypoint* wpt_tmp; +static route_head* trk_head; +static computed_trkdata* tdata; #define MYNAME "gtc" @@ -45,7 +45,7 @@ static double gtc_start_long; static double gtc_end_lat; static double gtc_end_long; -static char *opt_sport, *opt_course; +static char* opt_sport, *opt_course; static arglist_t gtc_args[] = { @@ -62,7 +62,7 @@ arglist_t gtc_args[] = { #if ! HAVE_LIBEXPAT static void -gtc_rd_init(const char *fname) +gtc_rd_init(const char* fname) { fatal(MYNAME ": this format does not support reading.\n"); } @@ -143,10 +143,10 @@ static xg_tag_mapping gtc_map[] = { { gtc_wpt_lat, cb_cdata, "/Courses/Course/Lap/BeginPosition/LatitudeDegrees" }, { gtc_wpt_long, cb_cdata, "/Courses/Course/Lap/BeginPosition/LongitudeDegrees" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; -static const char * +static const char* gtc_tags_to_ignore[] = { "TrainingCenterDatabase", "CourseFolder", @@ -158,7 +158,7 @@ gtc_tags_to_ignore[] = { }; static void -gtc_rd_init(const char *fname) +gtc_rd_init(const char* fname) { xml_init(fname, gtc_map, NULL); xml_ignore_tags(gtc_tags_to_ignore); @@ -178,7 +178,7 @@ gtc_rd_deinit(void) #endif static void -gtc_wr_init(const char *fname) +gtc_wr_init(const char* fname) { int i; @@ -205,7 +205,7 @@ gtc_wr_deinit(void) static int gtc_indent_level; static void -gtc_write_xml(int indent, const char *fmt, ...) +gtc_write_xml(int indent, const char* fmt, ...) { va_list args; @@ -226,7 +226,7 @@ gtc_write_xml(int indent, const char *fmt, ...) } static void -gtc_waypt_pr(const waypoint *wpt) +gtc_waypt_pr(const waypoint* wpt) { if (wpt->wpt_flags.is_split != 0) { gtc_write_xml(1, "\n"); @@ -314,7 +314,7 @@ gtc_fake_hdr(void) } static void -gtc_act_hdr(const route_head *rte) +gtc_act_hdr(const route_head* rte) { gtc_write_xml(1, "\n", gtc_sportlist[gtc_sport]); if (gtc_least_time) { @@ -330,7 +330,7 @@ gtc_act_hdr(const route_head *rte) } static void -gtc_act_ftr(const route_head *rte) +gtc_act_ftr(const route_head* rte) { gtc_write_xml(-1, "\n"); gtc_write_xml(-1, "\n"); @@ -338,12 +338,12 @@ gtc_act_ftr(const route_head *rte) } static void -gtc_crs_hdr(const route_head *rte) +gtc_crs_hdr(const route_head* rte) { gtc_write_xml(1, "\n"); if (rte->rte_name) { - char *name = xstrndup(rte->rte_name, GTC_MAX_NAME_LEN); + char* name = xstrndup(rte->rte_name, GTC_MAX_NAME_LEN); gtc_write_xml(0, "%s\n", name); xfree(name); } else { @@ -357,7 +357,7 @@ gtc_crs_hdr(const route_head *rte) } static void -gtc_crs_ftr(const route_head *rte) +gtc_crs_ftr(const route_head* rte) { gtc_write_xml(-1,"\n"); gtc_write_xml(-1, "\n"); @@ -365,20 +365,20 @@ gtc_crs_ftr(const route_head *rte) } static void -gtc_lap_start(const route_head *rte) +gtc_lap_start(const route_head* rte) { gtc_least_time = 0; gtc_most_time = 0; } static void -gtc_new_study_lap(const route_head *rte) +gtc_new_study_lap(const route_head* rte) { track_recompute(rte, &tdata); /* called routine allocates space for tdata */ } static void -gtc_study_lap(const waypoint *wpt) +gtc_study_lap(const waypoint* wpt) { if (wpt->creation_time && (gtc_least_time == 0)) { gtc_least_time = wpt->creation_time; @@ -422,39 +422,39 @@ gtc_write(void) } void -gtc_trk_s(const char *unused, const char **attrv) +gtc_trk_s(const char* unused, const char** attrv) { trk_head = route_head_alloc(); track_add_head(trk_head); } void -gtc_trk_ident(const char *args, const char **unused) +gtc_trk_ident(const char* args, const char** unused) { trk_head->rte_name = xstrdup(args); } void -gtc_trk_lap_s(const char *unused, const char **attrv) +gtc_trk_lap_s(const char* unused, const char** attrv) { lap_ct++; lap_s = 1; } void -gtc_trk_lap_e(const char *unused, const char **attrv) +gtc_trk_lap_e(const char* unused, const char** attrv) { lap_s = 0; } void -gtc_trk_pnt_s(const char *unused, const char **attrv) +gtc_trk_pnt_s(const char* unused, const char** attrv) { wpt_tmp = waypt_new(); } void -gtc_trk_pnt_e(const char *args, const char **unused) +gtc_trk_pnt_e(const char* args, const char** unused) { if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) { if (lap_s) { @@ -477,55 +477,55 @@ gtc_trk_pnt_e(const char *args, const char **unused) } void -gtc_trk_utc(const char *args, const char **unused) +gtc_trk_utc(const char* args, const char** unused) { wpt_tmp->creation_time = xml_parse_time(args, NULL); } void -gtc_trk_lat(const char *args, const char **unused) +gtc_trk_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } void -gtc_trk_long(const char *args, const char **unused) +gtc_trk_long(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } void -gtc_trk_alt(const char *args, const char **unused) +gtc_trk_alt(const char* args, const char** unused) { wpt_tmp->altitude = atof(args); } void -gtc_trk_hr(const char *args, const char **unused) +gtc_trk_hr(const char* args, const char** unused) { wpt_tmp->heartrate = atoi(args); } void -gtc_trk_cad(const char *args, const char **unused) +gtc_trk_cad(const char* args, const char** unused) { wpt_tmp->cadence = atoi(args); } void -gtc_trk_pwr(const char *args, const char **unused) +gtc_trk_pwr(const char* args, const char** unused) { wpt_tmp->power = atof(args); } void -gtc_wpt_pnt_s(const char *unused, const char **attrv) +gtc_wpt_pnt_s(const char* unused, const char** attrv) { wpt_tmp = waypt_new(); } void -gtc_wpt_pnt_e(const char *args, const char **unused) +gtc_wpt_pnt_e(const char* args, const char** unused) { if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) { waypt_add(wpt_tmp); @@ -537,13 +537,13 @@ gtc_wpt_pnt_e(const char *args, const char **unused) } void -gtc_wpt_lat(const char *args, const char **unused) +gtc_wpt_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } void -gtc_wpt_long(const char *args, const char **unused) +gtc_wpt_long(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } @@ -552,7 +552,7 @@ ff_vecs_t gtc_vecs = { ff_type_file, { ff_cap_read /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, gtc_rd_init, diff --git a/gpsbabel/height.c b/gpsbabel/height.c index 1853906e2..632681b15 100755 --- a/gpsbabel/height.c +++ b/gpsbabel/height.c @@ -27,8 +27,8 @@ #define MYNAME "height" #if FILTERS_ENABLED -static char *addopt = NULL; -static char *wgs84tomslopt = NULL; +static char* addopt = NULL; +static char* wgs84tomslopt = NULL; static double addf; @@ -124,9 +124,9 @@ static double wgs84_separation(double lat, double lon) static void -correct_height(const waypoint *wpt) +correct_height(const waypoint* wpt) { - waypoint *waypointp = (waypoint *) wpt; + waypoint* waypointp = (waypoint*) wpt; if (addopt) { waypointp->altitude += addf; @@ -139,9 +139,9 @@ correct_height(const waypoint *wpt) static void -height_init(const char *args) +height_init(const char* args) { - char *unit; + char* unit; if (addopt) { addf = strtod(addopt, &unit); diff --git a/gpsbabel/hiketech.c b/gpsbabel/hiketech.c index 1837611dd..cdde9a520 100644 --- a/gpsbabel/hiketech.c +++ b/gpsbabel/hiketech.c @@ -22,9 +22,9 @@ #include "defs.h" #include "xmlgeneric.h" -static gbfile *ofd; -static waypoint *wpt_tmp; -static route_head *trk_head; +static gbfile* ofd; +static waypoint* wpt_tmp; +static route_head* trk_head; #define MYNAME "hiketech" @@ -70,11 +70,11 @@ static xg_tag_mapping ht_map[] = { { ht_trk_lat, cb_cdata, "/hiketech/gpsdata/trk/pnt/lat" }, { ht_trk_long, cb_cdata, "/hiketech/gpsdata/trk/pnt/long" }, { ht_trk_alt, cb_cdata, "/hiketech/gpsdata/trk/pnt/alt" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; static void -hiketech_rd_init(const char *fname) +hiketech_rd_init(const char* fname) { xml_init(fname, ht_map, NULL); } @@ -92,7 +92,7 @@ hiketech_rd_deinit(void) } static void -hiketech_wr_init(const char *fname) +hiketech_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); } @@ -104,20 +104,20 @@ hiketech_wr_deinit(void) } static void -hiketech_trk_hdr(const route_head *rte) +hiketech_trk_hdr(const route_head* rte) { gbfprintf(ofd, "\n"); write_optional_xml_entity(ofd, " ", "ident", rte->rte_name); } static void -hiketech_trk_tlr(const route_head *rte) +hiketech_trk_tlr(const route_head* rte) { gbfprintf(ofd, "\n"); } static void -hiketech_print_utc(time_t tm, const char *indent, const char *tag) +hiketech_print_utc(time_t tm, const char* indent, const char* tag) { char tbuf[80]; strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %I:%M:%S", gmtime(&tm)); @@ -125,7 +125,7 @@ hiketech_print_utc(time_t tm, const char *indent, const char *tag) } static void -hiketech_trkpt_pr(const waypoint *waypointp) +hiketech_trkpt_pr(const waypoint* waypointp) { gbfprintf(ofd, " \n"); if (waypointp->creation_time) { @@ -141,7 +141,7 @@ hiketech_trkpt_pr(const waypoint *waypointp) } static void -hiketech_waypt_pr(const waypoint *wpt) +hiketech_waypt_pr(const waypoint* wpt) { gbfprintf(ofd, "\n"); write_xml_entity(ofd, "\t", "ident", wpt->shortname); @@ -170,82 +170,82 @@ hiketech_write(void) } static -void ht_wpt_s(const char *args, const char **unused) +void ht_wpt_s(const char* args, const char** unused) { wpt_tmp = waypt_new(); } static -void ht_ident(const char *args, const char **unused) +void ht_ident(const char* args, const char** unused) { wpt_tmp->shortname = xstrdup(args); } static -void ht_sym(const char *args, const char **unused) +void ht_sym(const char* args, const char** unused) { wpt_tmp->icon_descr = xstrdup(args); wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1; } static -void ht_lat(const char *args, const char **unused) +void ht_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } static -void ht_long(const char *args, const char **unused) +void ht_long(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } static -void ht_alt(const char *args, const char **unused) +void ht_alt(const char* args, const char** unused) { wpt_tmp->altitude = atof(args); } static -void ht_wpt_e(const char *args, const char **unused) +void ht_wpt_e(const char* args, const char** unused) { waypt_add(wpt_tmp); wpt_tmp = NULL; } static -void ht_trk_s(const char *args, const char **unused) +void ht_trk_s(const char* args, const char** unused) { trk_head = route_head_alloc(); track_add_head(trk_head); } static -void ht_trk_e(const char *args, const char **unused) +void ht_trk_e(const char* args, const char** unused) { } static -void ht_trk_ident(const char *args, const char **unused) +void ht_trk_ident(const char* args, const char** unused) { trk_head->rte_name = xstrdup(args); } static -void ht_trk_pnt_s(const char *args, const char **unused) +void ht_trk_pnt_s(const char* args, const char** unused) { wpt_tmp = waypt_new(); } static -void ht_trk_pnt_e(const char *args, const char **unused) +void ht_trk_pnt_e(const char* args, const char** unused) { track_add_wpt(trk_head, wpt_tmp); } static -void ht_trk_utc(const char *args, const char **unused) +void ht_trk_utc(const char* args, const char** unused) { struct tm tm; time_t utc; @@ -264,19 +264,19 @@ void ht_trk_utc(const char *args, const char **unused) } static -void ht_trk_lat(const char *args, const char **unused) +void ht_trk_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } static -void ht_trk_long(const char *args, const char **unused) +void ht_trk_long(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } static -void ht_trk_alt(const char *args, const char **unused) +void ht_trk_alt(const char* args, const char** unused) { wpt_tmp->altitude = atof(args); } @@ -285,7 +285,7 @@ void ht_trk_alt(const char *args, const char **unused) ff_vecs_t hiketech_vecs = { ff_type_file, - { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write }, + { (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write) }, hiketech_rd_init, hiketech_wr_init, hiketech_rd_deinit, diff --git a/gpsbabel/holux.c b/gpsbabel/holux.c index 2d3eecbcf..5432c6864 100644 --- a/gpsbabel/holux.c +++ b/gpsbabel/holux.c @@ -32,14 +32,14 @@ History: #include "holux.h" -static gbfile *file_in, *file_out; -static unsigned char *HxWFile; +static gbfile* file_in, *file_out; +static unsigned char* HxWFile; static short_handle mkshort_handle; #define MYNAME "Holux" -static void rd_init(const char *fname) +static void rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -55,11 +55,11 @@ static void rd_deinit(void) static void -wr_init(const char *fname) +wr_init(const char* fname) { mkshort_handle = mkshort_new_handle(); - HxWFile = xcalloc(GM100_WPO_FILE_SIZE, 1); + HxWFile = (unsigned char*) xcalloc(GM100_WPO_FILE_SIZE, 1); file_out = gbfopen_le(fname, "wb", MYNAME); } @@ -80,19 +80,19 @@ static void data_read(void) { char name[9], desc[90]; double lat,lon; - unsigned char *HxWpt; - waypoint *wpt_tmp; + unsigned char* HxWpt; + waypoint* wpt_tmp; int iCount; int iDataRead; int iWptNum; int iWptIndex; - WPT *pWptHxTmp; + WPT* pWptHxTmp; struct tm tm; - struct tm *ptm; + struct tm* ptm; memset(&tm, 0, sizeof(tm)); - HxWpt = xcalloc(GM100_WPO_FILE_SIZE, 1); + HxWpt = (unsigned char*) xcalloc(GM100_WPO_FILE_SIZE, 1); /* read the wpo file to the data-array */ iDataRead = gbfread(HxWpt, 1, GM100_WPO_FILE_SIZE, file_in); @@ -101,14 +101,14 @@ static void data_read(void) fatal(MYNAME ": Error reading data from %s.\n", file_in->name); } - iWptNum = le_read16(&((WPTHDR *)HxWpt)->num); + iWptNum = le_read16(&((WPTHDR*)HxWpt)->num); /* Get the waypoints */ for (iCount = 0; iCount < iWptNum ; iCount ++) { wpt_tmp = waypt_new(); - iWptIndex = le_read16(&((WPTHDR *)HxWpt)->idx[iCount]); - pWptHxTmp = (WPT *)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)]; + iWptIndex = le_read16(&((WPTHDR*)HxWpt)->idx[iCount]); + pWptHxTmp = (WPT*)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)]; wpt_tmp->altitude = 0; strncpy(name,pWptHxTmp->name,sizeof(pWptHxTmp->name)); @@ -155,12 +155,12 @@ static void data_read(void) -char *mknshort(char *stIn,unsigned int sLen) +char* mknshort(char* stIn,unsigned int sLen) { #define MAX_STRINGLEN 255 static char strOut[MAX_STRINGLEN]; char strTmp[MAX_STRINGLEN]; - char *shortstr = NULL; + char* shortstr = NULL; if (sLen > MAX_STRINGLEN) { return (stIn); @@ -185,12 +185,12 @@ char *mknshort(char *stIn,unsigned int sLen) -static void holux_disp(const waypoint *wpt) +static void holux_disp(const waypoint* wpt) { double lon,lat; - struct tm *tm; + struct tm* tm; short sIndex; - WPT *pWptHxTmp; + WPT* pWptHxTmp; lon =(double)wpt->longitude * 36000; lat =(double)wpt->latitude * -36000; @@ -204,14 +204,14 @@ static void holux_disp(const waypoint *wpt) lat += (double)((int)lat/abs((int)lat)) * .5; } - sIndex = le_read16(&((WPTHDR *)HxWFile)->num); - ((WPTHDR *)HxWFile)->idx[sIndex] = sIndex; /* set the waypoint index */ - le_write16(&((WPTHDR *)HxWFile)->idx[sIndex], sIndex); /* set the waypoint index */ - ((WPTHDR *)HxWFile)->used[sIndex] = 0xff; /* Waypoint used */ + sIndex = le_read16(&((WPTHDR*)HxWFile)->num); + ((WPTHDR*)HxWFile)->idx[sIndex] = sIndex; /* set the waypoint index */ + le_write16(&((WPTHDR*)HxWFile)->idx[sIndex], sIndex); /* set the waypoint index */ + ((WPTHDR*)HxWFile)->used[sIndex] = 0xff; /* Waypoint used */ /* set Waypoint */ - pWptHxTmp = (WPT *)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)]; + pWptHxTmp = (WPT*)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)]; memset(pWptHxTmp->name,0x20,sizeof(pWptHxTmp->name)); if (wpt->shortname != NULL) { @@ -245,8 +245,8 @@ static void holux_disp(const waypoint *wpt) le_write32(&pWptHxTmp->pt.iLongitude,(unsigned int) lon); pWptHxTmp->checked = 01; pWptHxTmp->vocidx = (short)0xffff; - le_write16(&((WPTHDR *)HxWFile)->num, ++sIndex); - le_write16(&((WPTHDR *)HxWFile)->next, ++sIndex); + le_write16(&((WPTHDR*)HxWFile)->num, ++sIndex); + le_write16(&((WPTHDR*)HxWFile)->next, ++sIndex); } @@ -260,30 +260,30 @@ static void data_write(void) short sCount; /* init the waypoint area*/ - le_write32(&((WPTHDR *)HxWFile)->id, WPT_HDR_ID); - ((WPTHDR *)HxWFile)->num = 0; - ((WPTHDR *)HxWFile)->next = 0; + le_write32(&((WPTHDR*)HxWFile)->id, WPT_HDR_ID); + ((WPTHDR*)HxWFile)->num = 0; + ((WPTHDR*)HxWFile)->next = 0; /* clear index list */ for (sCount = 0; sCount < MAXWPT; sCount++) { - ((WPTHDR *)HxWFile)->idx[sCount] = (signed short)-1; + ((WPTHDR*)HxWFile)->idx[sCount] = (signed short)-1; } for (sCount = 0; sCount < MAXWPT; sCount++) { - ((WPTHDR *)HxWFile)->used[sCount] = 0; + ((WPTHDR*)HxWFile)->used[sCount] = 0; } /* init the route area */ - le_write32(&((RTEHDR *)&HxWFile[ROUTESTART])->id, RTE_HDR_ID); - ((RTEHDR *)&HxWFile[ROUTESTART])->num = 0; - le_write16(&((RTEHDR *)&HxWFile[ROUTESTART])->next, 1); - ((RTEHDR *)&HxWFile[ROUTESTART])->rteno = (signed short)-1; + le_write32(&((RTEHDR*)&HxWFile[ROUTESTART])->id, RTE_HDR_ID); + ((RTEHDR*)&HxWFile[ROUTESTART])->num = 0; + le_write16(&((RTEHDR*)&HxWFile[ROUTESTART])->next, 1); + ((RTEHDR*)&HxWFile[ROUTESTART])->rteno = (signed short)-1; /* clear index list */ for (sCount = 0; sCount < MAXRTE; sCount++) { - ((RTEHDR *)&HxWFile[ROUTESTART])->idx[sCount] = (signed short)-1; + ((RTEHDR*)&HxWFile[ROUTESTART])->idx[sCount] = (signed short)-1; } for (sCount = 0; sCount < MAXRTE; sCount++) { - ((RTEHDR *)&HxWFile[ROUTESTART])->used[sCount] = 0; + ((RTEHDR*)&HxWFile[ROUTESTART])->used[sCount] = 0; } waypt_disp_all(holux_disp); diff --git a/gpsbabel/hsa_ndv.c b/gpsbabel/hsa_ndv.c index 83d8eb851..9eec3bf6f 100644 --- a/gpsbabel/hsa_ndv.c +++ b/gpsbabel/hsa_ndv.c @@ -23,13 +23,13 @@ static XML_Parser psr; #endif -static char *cdatastr; +static char* cdatastr; static int in_Route = 0; static int in_ChartWork = 0; static int in_Object = 0; -static waypoint *wpt_tmp; -static char *routeName = "ROUTENAME"; +static waypoint* wpt_tmp; +static char* routeName = "ROUTENAME"; #define REPLACEMENT_SIRIUS_ATTR_SEPARATOR ';' #define ATTR_USRMRK "usrmrk" @@ -37,10 +37,10 @@ static char *routeName = "ROUTENAME"; #define ATTR_SHIPNAME "shpnam" static void readVersion4(gbfile* pFile); -static void getAttr(const char *data, const char *attr, char **val, char seperator); +static void getAttr(const char* data, const char* attr, char** val, char seperator); -static gbfile *fd; -static gbfile *ofd; +static gbfile* fd; +static gbfile* ofd; static arglist_t hsa_ndv_args[] = { @@ -53,7 +53,7 @@ arglist_t hsa_ndv_args[] = { #if ! HAVE_LIBEXPAT static void -hsa_ndv_rd_init(const char *fname) +hsa_ndv_rd_init(const char* fname) { fatal(MYNAME ": This build excluded HSA Endeavour support because expat was not installed.\n"); } @@ -65,9 +65,9 @@ hsa_ndv_read(void) #else static void -hsa_ndv_start(void *data, const XML_Char *xml_el, const XML_Char **attr) +hsa_ndv_start(void* data, const XML_Char* xml_el, const XML_Char** attr) { - const char *el = xml_convert_to_char_string(xml_el); + const char* el = xml_convert_to_char_string(xml_el); // printf("<%s>\n", el); if (strcmp(el, "Export") == 0) { @@ -87,9 +87,9 @@ hsa_ndv_start(void *data, const XML_Char *xml_el, const XML_Char **attr) } static void -hsa_ndv_end(void *data, const XML_Char *xml_el) +hsa_ndv_end(void* data, const XML_Char* xml_el) { - const char *el = xml_convert_to_char_string(xml_el); + const char* el = xml_convert_to_char_string(xml_el); if (in_Route) { if (strcmp(el, "Version") == 0) { //don't really care @@ -153,15 +153,15 @@ hsa_ndv_end(void *data, const XML_Char *xml_el) } static void -hsa_ndv_cdata(void *dta, const XML_Char *s, int len) +hsa_ndv_cdata(void* dta, const XML_Char* s, int len) { - char *estr; + char* estr; estr = cdatastr + strlen(cdatastr); memcpy(estr, s, len); } static void -hsa_ndv_rd_init(const char *fname) +hsa_ndv_rd_init(const char* fname) { fd = gbfopen(fname, "r", MYNAME); @@ -172,7 +172,7 @@ hsa_ndv_rd_init(const char *fname) XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); XML_SetElementHandler(psr, hsa_ndv_start, hsa_ndv_end); - cdatastr = xcalloc(MY_CBUF,1); + cdatastr = (char*) xcalloc(MY_CBUF,1); XML_SetCharacterDataHandler(psr, hsa_ndv_cdata); } @@ -183,7 +183,7 @@ hsa_ndv_read(void) char buf[MY_CBUF + 1]; while ((len = gbfread(buf, 1, sizeof(buf) - 1, fd))) { - char *bad; + char* bad; buf[len] = '\0'; if (NULL != strstr(buf, "nver=1")) { @@ -209,11 +209,11 @@ hsa_ndv_read(void) #endif -static void getAttr(const char *data, const char *attr, char **val, char seperator) +static void getAttr(const char* data, const char* attr, char** val, char seperator) { - char *start; + char* start; if ((start = strstr(data, attr)) != NULL) { - char *end; + char* end; int len; end = strchr(start, seperator); @@ -223,11 +223,11 @@ static void getAttr(const char *data, const char *attr, char **val, char seperat len = end-start - strlen(attr); - *val = xcalloc(len+1, 1); + *val = (char*) xcalloc(len+1, 1); memcpy(*val, start+strlen(attr), len); (*val)[len] = '\0'; } else { - *val = xcalloc(1, 1); + *val = (char*) xcalloc(1, 1); (*val)[0] = '\0'; } } @@ -241,7 +241,7 @@ hsa_ndv_rd_deinit(void) } static void -hsa_ndv_wr_init(const char *fname) +hsa_ndv_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); } @@ -255,7 +255,7 @@ hsa_ndv_wr_deinit(void) static int legNum = 0; static void -hsa_ndv_waypt_pr(const waypoint *waypointp) +hsa_ndv_waypt_pr(const waypoint* waypointp) { gbfprintf(ofd, "\t\t\n"); @@ -327,7 +327,7 @@ ff_vecs_t HsaEndeavourNavigator_vecs = { #define INVALID_TIME -1L #define SOUNDARRAY_CHAR 'S' -static int readRecord(gbfile* pFile, const char* pRecName, char *recData); +static int readRecord(gbfile* pFile, const char* pRecName, char* recData); static int readPositionRecord(gbfile* pFile, double* lat, double* lng, long* timeStamp); static void readVersion4(gbfile* pFile) @@ -364,7 +364,7 @@ static void readVersion4(gbfile* pFile) sscanf((const char*)recData, "%d", &numberOfVerticies); // do we have a sounding array - if (*((const char *)recData + strlen(recData) - 1) == SOUNDARRAY_CHAR) { + if (*((const char*)recData + strlen(recData) - 1) == SOUNDARRAY_CHAR) { soundArray = TRUE; } @@ -402,7 +402,7 @@ static void readVersion4(gbfile* pFile) getAttr(attr, ATTR_USRMRK, &wpt_tmp->description, '\x1f'); { - char *bad; + char* bad; //remove \n and \x1f from description data while (NULL != (bad = strchr(wpt_tmp->description, '\x1f'))) { *bad = REPLACEMENT_SIRIUS_ATTR_SEPARATOR; @@ -423,7 +423,7 @@ static void readVersion4(gbfile* pFile) } // read a record to a file -static int readRecord(gbfile* pFile, const char* pRecName, char *recData) +static int readRecord(gbfile* pFile, const char* pRecName, char* recData) { // get the rec name int len; diff --git a/gpsbabel/html.c b/gpsbabel/html.c index 5d018a8af..ff1fba2d7 100644 --- a/gpsbabel/html.c +++ b/gpsbabel/html.c @@ -24,14 +24,14 @@ #include "jeeps/gpsmath.h" #include -static gbfile *file_out; +static gbfile* file_out; static short_handle mkshort_handle; -static char *stylesheet = NULL; -static char *html_encrypt = NULL; -static char *includelogs = NULL; -static char *degformat = NULL; -static char *altunits = NULL; +static char* stylesheet = NULL; +static char* html_encrypt = NULL; +static char* includelogs = NULL; +static char* degformat = NULL; +static char* altunits = NULL; #define MYNAME "HTML" @@ -63,7 +63,7 @@ arglist_t html_args[] = { static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen(fname, "w", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -77,15 +77,15 @@ wr_deinit(void) } static void -html_disp(const waypoint *wpt) +html_disp(const waypoint* wpt) { char tbuf[1024]; - char *cout; + char* cout; time_t tm = wpt->creation_time; gbint32 utmz; double utme, utmn; char utmzc; - fs_xml *fs_gpx = NULL; + fs_xml* fs_gpx = NULL; GPS_Math_WGS84_To_UTM_EN(wpt->latitude, wpt->longitude, @@ -109,7 +109,7 @@ html_disp(const waypoint *wpt) gbfprintf(file_out, "
\n"); if (strcmp(wpt->description, wpt->shortname)) { if (wpt->url) { - char *d = html_entitize(wpt->description); + char* d = html_entitize(wpt->description); gbfprintf(file_out, "%s", wpt->url, d); xfree(d); } else { @@ -135,17 +135,17 @@ html_disp(const waypoint *wpt) gbfprintf(file_out, ""); if (wpt->gc_data->desc_short.utfstring) { - char *tmpstr = strip_nastyhtml(wpt->gc_data->desc_short.utfstring); + char* tmpstr = strip_nastyhtml(wpt->gc_data->desc_short.utfstring); gbfprintf(file_out, "

%s

\n", tmpstr); xfree(tmpstr); } if (wpt->gc_data->desc_long.utfstring) { - char *tmpstr = strip_nastyhtml(wpt->gc_data->desc_long.utfstring); + char* tmpstr = strip_nastyhtml(wpt->gc_data->desc_long.utfstring); gbfprintf(file_out, "

%s

\n", tmpstr); xfree(tmpstr); } if (wpt->gc_data->hint) { - char *hint = NULL; + char* hint = NULL; if (html_encrypt) { hint = rot13(wpt->gc_data->hint); } else { @@ -159,17 +159,17 @@ html_disp(const waypoint *wpt) fs_gpx = NULL; if (includelogs) { - fs_gpx = (fs_xml *)fs_chain_find(wpt->fs, FS_GPX); + fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); } if (fs_gpx && fs_gpx->tag) { - xml_tag *root = fs_gpx->tag; - xml_tag *curlog = NULL; - xml_tag *logpart = NULL; + xml_tag* root = fs_gpx->tag; + xml_tag* curlog = NULL; + xml_tag* logpart = NULL; curlog = xml_findfirst(root, "groundspeak:log"); while (curlog) { time_t logtime = 0; - struct tm *logtm = NULL; + struct tm* logtm = NULL; gbfprintf(file_out, "

\n"); logpart = xml_findfirst(curlog, "groundspeak:type"); @@ -179,7 +179,7 @@ html_disp(const waypoint *wpt) logpart = xml_findfirst(curlog, "groundspeak:finder"); if (logpart) { - char *f = html_entitize(logpart->cdata); + char* f = html_entitize(logpart->cdata); gbfprintf(file_out, "%s on ", f); xfree(f); } @@ -199,7 +199,7 @@ html_disp(const waypoint *wpt) logpart = xml_findfirst(curlog, "groundspeak:log_wpt"); if (logpart) { - char *coordstr = NULL; + char* coordstr = NULL; float lat = 0; float lon = 0; coordstr = xml_attribute(logpart, "lat"); @@ -219,9 +219,9 @@ html_disp(const waypoint *wpt) logpart = xml_findfirst(curlog, "groundspeak:text"); if (logpart) { - char *encstr = NULL; - char *s = NULL; - char *t = NULL; + char* encstr = NULL; + char* s = NULL; + char* t = NULL; int encoded = 0; encstr = xml_attribute(logpart, "encoded"); encoded = (encstr[0] != 'F'); @@ -246,10 +246,10 @@ html_disp(const waypoint *wpt) } static void -html_index(const waypoint *wpt) +html_index(const waypoint* wpt) { - char *sn = html_entitize(wpt->shortname); - char *d = html_entitize(wpt->description); + char* sn = html_entitize(wpt->shortname); + char* d = html_entitize(wpt->description); gbfprintf(file_out, "%s - %s
\n", sn, sn, d); diff --git a/gpsbabel/humminbird.c b/gpsbabel/humminbird.c index a44e127f4..4eaa7f85e 100644 --- a/gpsbabel/humminbird.c +++ b/gpsbabel/humminbird.c @@ -172,8 +172,8 @@ static gbfile* fin; static gbfile* fout; static int waypoint_num; static short_handle wptname_sh, rtename_sh, trkname_sh; -static avltree_t *waypoints; -static humminbird_rte_t *humrte; +static avltree_t* waypoints; +static humminbird_rte_t* humrte; static int rte_num; static @@ -229,7 +229,7 @@ inverse_gudermannian_i1924(const double x) *******************************************************************************/ static void -humminbird_rd_init(const char *fname) +humminbird_rd_init(const char* fname) { fin = gbfopen_be(fname, "rb", MYNAME); waypoints = avltree_init(0, MYNAME); @@ -249,7 +249,7 @@ humminbird_read_wpt(gbfile* fin) humminbird_waypt_t w; double guder; int num_icons; - waypoint *wpt; + waypoint* wpt; char buff[10]; if (! gbfread(&w, 1, sizeof(w), fin)) { @@ -308,16 +308,16 @@ humminbird_read_route(gbfile* fin) if (hrte.count > 0) { int i; - route_head *rte = NULL; + route_head* rte = NULL; for (i = 0; i < hrte.count; i++) { - waypoint *wpt; + waypoint* wpt; char buff[10]; hrte.points[i] = be_read16(&hrte.points[i]); /* locate the point over his internal Humminbird "Number" */ snprintf(buff, sizeof(buff), "%d", hrte.points[i]); - if (avltree_find(waypoints, buff, (void *) &wpt)) { + if (avltree_find(waypoints, buff, (const void**) &wpt)) { if (rte == NULL) { rte = route_head_alloc(); route_add_head(rte); @@ -371,7 +371,7 @@ humminbird_read_track(gbfile* fin) /* num_points is actually one too big, because it includes the value in the header. But we want the extra point at the end because the freak-value filter below looks at points[i+1] */ - points = xcalloc(th.num_points, sizeof(humminbird_trk_point_t)); + points = (humminbird_trk_point_t*) xcalloc(th.num_points, sizeof(humminbird_trk_point_t)); if (! gbfread(points, sizeof(humminbird_trk_point_t), th.num_points-1, fin)) { fatal(MYNAME ": Unexpected end of file reading points!\n"); } @@ -396,7 +396,7 @@ humminbird_read_track(gbfile* fin) track_add_wpt(trk, first_wpt); for (i=0 ; iicon_descr, match); @@ -709,16 +709,16 @@ static gbuint32 last_time; static void -humminbird_track_head(const route_head *trk) +humminbird_track_head(const route_head* trk) { int max_points = (131080 - sizeof(gbuint32)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t); trk_head = NULL; last_time = 0; if (trk->rte_waypt_ct > 0) { - char *name; - trk_head = xcalloc(1, sizeof(humminbird_trk_header_t)); - trk_points = xcalloc(max_points, sizeof(humminbird_trk_point_t)); + char* name; + trk_head = (humminbird_trk_header_t*) xcalloc(1, sizeof(humminbird_trk_header_t)); + trk_points = (humminbird_trk_point_t*) xcalloc(max_points, sizeof(humminbird_trk_point_t)); name = mkshort(trkname_sh, trk->rte_name); strncpy(trk_head->name, name, sizeof(trk_head->name)); @@ -728,7 +728,7 @@ humminbird_track_head(const route_head *trk) } static void -humminbird_track_tail(const route_head *rte) +humminbird_track_tail(const route_head* rte) { int max_points = (131080 - sizeof(gbuint32)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t); @@ -765,7 +765,7 @@ humminbird_track_tail(const route_head *rte) } static void -humminbird_track_cb(const waypoint *wpt) +humminbird_track_cb(const waypoint* wpt) { gbint32 north, east; double lat; @@ -841,16 +841,16 @@ humminbird_track_write(void) } static void -humminbird_rte_head(const route_head *rte) +humminbird_rte_head(const route_head* rte) { humrte = NULL; if (rte->rte_waypt_ct > 0) { - humrte = xcalloc(1, sizeof(*humrte)); + humrte = (humminbird_rte_t*) xcalloc(1, sizeof(*humrte)); } } static void -humminbird_rte_tail(const route_head *rte) +humminbird_rte_tail(const route_head* rte) { if (humrte == NULL) { return; @@ -858,7 +858,7 @@ humminbird_rte_tail(const route_head *rte) if (humrte->count > 0) { int i; - char *name; + char* name; humrte->num = rte_num++; humrte->time = gpsbabel_time; @@ -882,7 +882,7 @@ humminbird_rte_tail(const route_head *rte) } static void -humminbird_write_rtept(const waypoint *wpt) +humminbird_write_rtept(const waypoint* wpt) { int i; @@ -904,23 +904,23 @@ humminbird_write_rtept(const waypoint *wpt) } static void -humminbird_write_waypoint_wrapper(const waypoint *wpt) +humminbird_write_waypoint_wrapper(const waypoint* wpt) { - char *key; - waypoint *tmpwpt; + char* key; + waypoint* tmpwpt; xasprintf(&key, "%s\01%.9f\01%.9f", wpt->shortname, wpt->latitude, wpt->longitude); - if (! avltree_find(waypoints, key, (void *)&tmpwpt)) { - tmpwpt = (waypoint *)wpt; + if (! avltree_find(waypoints, key, (const void**)&tmpwpt)) { + tmpwpt = (waypoint*)wpt; avltree_insert(waypoints, key, wpt); tmpwpt->extra_data = gb_int2ptr(waypoint_num + 1); /* NOT NULL */ humminbird_write_waypoint(wpt); } else { - void *p = tmpwpt->extra_data; - tmpwpt = (waypoint *)wpt; + void* p = tmpwpt->extra_data; + tmpwpt = (waypoint*)wpt; tmpwpt->extra_data = p; } @@ -940,9 +940,9 @@ humminbird_write(void) ff_vecs_t humminbird_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_read /* tracks */, - ff_cap_read | ff_cap_write /* routes */ + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */ }, humminbird_rd_init, humminbird_wr_init, @@ -964,7 +964,7 @@ ff_vecs_t humminbird_ht_vecs = { ff_type_file, { ff_cap_read /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_read /* routes */ }, humminbird_rd_init, diff --git a/gpsbabel/igc.c b/gpsbabel/igc.c index af5294b37..0dad151e8 100644 --- a/gpsbabel/igc.c +++ b/gpsbabel/igc.c @@ -26,10 +26,10 @@ #include "defs.h" #include -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static char manufacturer[4]; -static const route_head *head; -static char *timeadj = NULL; +static const route_head* head; +static char* timeadj = NULL; static int lineno; #define MYNAME "IGC" @@ -88,10 +88,10 @@ static unsigned char coords_match(double lat1, double lon1, double lat2, double * @param rec Caller allocated storage for the record. At least MAXRECLEN chars must be allocated. * @return the record type. rec_none on EOF, rec_bad on fgets() or parse error. */ -static igc_rec_type_t get_record(char **rec) +static igc_rec_type_t get_record(char** rec) { size_t len; - char *c; + char* c; retry: *rec = c = gbfgetstr(file_in); if ((lineno++ == 0) && file_in->unicode) { @@ -115,9 +115,9 @@ retry: return (igc_rec_type_t) c[0]; } -static void rd_init(const char *fname) +static void rd_init(const char* fname) { - char *ibuf; + char* ibuf; file_in = gbfopen(fname, "r", MYNAME); lineno = 0; @@ -137,16 +137,16 @@ static void rd_deinit(void) * A route is created for each set of waypoints in a task declaration. * @param rec A single task record */ -static void igc_task_rec(const char *rec) +static void igc_task_rec(const char* rec) { static char flight_date[7]; static unsigned int num_tp, tp_ct; - static route_head *rte_head; + static route_head* rte_head; static time_t creation; char task_num[5]; char task_desc[MAXRECLEN]; - waypoint *wpt; + waypoint* wpt; unsigned int lat_deg, lat_min, lat_frac; unsigned int lon_deg, lon_min, lon_frac; char lat_hemi[2], lon_hemi[2]; @@ -246,26 +246,26 @@ static void igc_task_rec(const char *rec) static void data_read(void) { - char *ibuf; + char* ibuf; igc_rec_type_t rec_type; unsigned int hours, mins, secs; unsigned int lat_deg, lat_min, lat_frac; unsigned int lon_deg, lon_min, lon_frac; char lat_hemi[2], lon_hemi[2]; char validity; - route_head *pres_head = NULL; - route_head *gnss_head = NULL; + route_head* pres_head = NULL; + route_head* gnss_head = NULL; int pres_alt, gnss_alt; char pres_valid = 0; char gnss_valid = 0; - waypoint *pres_wpt = NULL; - waypoint *gnss_wpt = NULL; + waypoint* pres_wpt = NULL; + waypoint* gnss_wpt = NULL; time_t date = 0; time_t prev_tod = 0; time_t tod; struct tm tm; char tmp_str[20]; - char *hdr_data; + char* hdr_data; size_t remain; char trk_desc[MAXDESCLEN + 1]; @@ -453,21 +453,21 @@ static void data_read(void) * Callbacks used to scan for specific track types */ -static void detect_pres_track(const route_head * rh) +static void detect_pres_track(const route_head* rh) { if (rh->rte_name && strncmp(rh->rte_name, PRESTRKNAME, 6) == 0) { head = rh; } } -static void detect_gnss_track(const route_head * rh) +static void detect_gnss_track(const route_head* rh) { if (rh->rte_name && strncmp(rh->rte_name, GNSSTRKNAME, 6) == 0) { head = rh; } } -static void detect_other_track(const route_head * rh) +static void detect_other_track(const route_head* rh) { static int max_waypt_ct; @@ -491,7 +491,7 @@ static void detect_other_track(const route_head * rh) * @param gnss_track Set by the function to the GNSS altitude track * head. NULL if not found. */ -static void get_tracks(const route_head ** pres_track, const route_head ** gnss_track) +static void get_tracks(const route_head** pres_track, const route_head** gnss_track) { head = NULL; track_disp_all(detect_pres_track, NULL, NULL); @@ -517,7 +517,7 @@ static void get_tracks(const route_head ** pres_track, const route_head ** gnss_ * IGC string formatting functions */ -static char *latlon2str(const waypoint * wpt) +static char* latlon2str(const waypoint* wpt) { static char str[18] = ""; char lat_hemi = wpt->latitude < 0 ? 'S' : 'N'; @@ -534,7 +534,7 @@ static char *latlon2str(const waypoint * wpt) return str; } -static char *date2str(struct tm *dt) +static char* date2str(struct tm* dt) { static char str[7] = ""; @@ -544,7 +544,7 @@ static char *date2str(struct tm *dt) return str; } -static char *tod2str(struct tm *tod) +static char* tod2str(struct tm* tod) { static char str[7] = ""; @@ -559,13 +559,13 @@ static char *tod2str(struct tm *tod) */ static void wr_header(void) { - const route_head *pres_track; - const route_head *track; - struct tm *tm; + const route_head* pres_track; + const route_head* track; + struct tm* tm; time_t date; static const char dflt_str[] = "Unknown"; - const char *str; - waypoint *wpt; + const char* str; + waypoint* wpt; get_tracks(&pres_track, &track); if (!track && pres_track) { @@ -573,7 +573,7 @@ static void wr_header(void) } // Date in header record is that of the first fix record date = !track ? current_time() : - ((waypoint *) QUEUE_FIRST(&track->waypoint_list))->creation_time; + ((waypoint*) QUEUE_FIRST(&track->waypoint_list))->creation_time; if (NULL == (tm = gmtime(&date))) { fatal(MYNAME ": Bad track timestamp\n"); @@ -602,20 +602,20 @@ static void wr_header(void) * Generation of IGC task declaration records */ -static void wr_task_wpt_name(const waypoint * wpt, const char *alt_name) +static void wr_task_wpt_name(const waypoint* wpt, const char* alt_name) { gbfprintf(file_out, "C%s%s\r\n", latlon2str(wpt), wpt->description ? wpt->description : wpt->shortname ? wpt->shortname : alt_name); } -static void wr_task_hdr(const route_head * rte) +static void wr_task_hdr(const route_head* rte) { unsigned char have_takeoff = 0; - const waypoint *wpt; + const waypoint* wpt; char flight_date[7] = "000000"; char task_desc[MAXRECLEN] = ""; int num_tps = rte->rte_waypt_ct - 2; - struct tm *tm; + struct tm* tm; time_t rte_time; static unsigned int task_num = 1; @@ -624,11 +624,11 @@ static void wr_task_hdr(const route_head * rte) } // See if the takeoff and landing waypoints are there or if we need to // generate them. - wpt = (waypoint *) QUEUE_LAST(&rte->waypoint_list); + wpt = (waypoint*) QUEUE_LAST(&rte->waypoint_list); if (wpt->shortname && strncmp(wpt->shortname, "LANDING", 6) == 0) { num_tps--; } - wpt = (waypoint *) QUEUE_FIRST(&rte->waypoint_list); + wpt = (waypoint*) QUEUE_FIRST(&rte->waypoint_list); if (wpt->shortname && strncmp(wpt->shortname, "TAKEOFF", 6) == 0) { have_takeoff = 1; num_tps--; @@ -657,15 +657,15 @@ static void wr_task_hdr(const route_head * rte) } } -static void wr_task_wpt(const waypoint * wpt) +static void wr_task_wpt(const waypoint* wpt) { wr_task_wpt_name(wpt, ""); } -static void wr_task_tlr(const route_head * rte) +static void wr_task_tlr(const route_head* rte) { // If the landing waypoint is not supplied we need to generate it. - const waypoint *wpt = (waypoint *) QUEUE_LAST(&rte->waypoint_list); + const waypoint* wpt = (waypoint*) QUEUE_LAST(&rte->waypoint_list); if (!wpt->shortname || strncmp(wpt->shortname, "LANDIN", 6) != 0) { wr_task_wpt_name(wpt, "LANDING"); } @@ -679,9 +679,9 @@ static void wr_tasks(void) /* * Write a single fix record */ -static void wr_fix_record(const waypoint * wpt, int pres_alt, int gnss_alt) +static void wr_fix_record(const waypoint* wpt, int pres_alt, int gnss_alt) { - struct tm *tm; + struct tm* tm; if (NULL == (tm = gmtime(&wpt->creation_time))) { fatal(MYNAME ": bad track timestamp\n"); @@ -705,56 +705,56 @@ static void wr_fix_record(const waypoint * wpt, int pres_alt, int gnss_alt) * @return The number of seconds to add to the GNSS track in order to align * it with the pressure track. */ -static int correlate_tracks(const route_head * pres_track, const route_head * gnss_track) +static int correlate_tracks(const route_head* pres_track, const route_head* gnss_track) { - const queue *elem; + const queue* elem; double last_alt, alt_diff; double speed; time_t pres_time, gnss_time; int time_diff; - const waypoint *wpt; + const waypoint* wpt; // Deduce the landing time from the pressure altitude track based on // when we last descended to within 10m of the final track altitude. elem = QUEUE_LAST(&pres_track->waypoint_list); - last_alt = ((waypoint *) elem)->altitude; + last_alt = ((waypoint*) elem)->altitude; do { elem = elem->prev; if (&pres_track->waypoint_list == elem) { // No track left return 0; } - alt_diff = last_alt - ((waypoint *) elem)->altitude; + alt_diff = last_alt - ((waypoint*) elem)->altitude; if (alt_diff > 10.0) { // Last part of track was ascending return 0; } } while (alt_diff > -10.0); - pres_time = ((waypoint *) elem->next)->creation_time; + pres_time = ((waypoint*) elem->next)->creation_time; if (global_opts.debug_level >= 1) { printf(MYNAME ": pressure landing time %s", ctime(&pres_time)); } // Deduce the landing time from the GNSS altitude track based on // when the groundspeed last dropped below a certain level. elem = QUEUE_LAST(&gnss_track->waypoint_list); - last_alt = ((waypoint *) elem)->altitude; + last_alt = ((waypoint*) elem)->altitude; do { - wpt = (waypoint *) elem; + wpt = (waypoint*) elem; elem = elem->prev; if (&gnss_track->waypoint_list == elem) { // No track left return 0; } // Get a crude indication of groundspeed from the change in lat/lon - time_diff = wpt->creation_time - ((waypoint *) elem)->creation_time; + time_diff = wpt->creation_time - ((waypoint*) elem)->creation_time; speed = !time_diff ? 0 : - (fabs(wpt->latitude - ((waypoint *) elem)->latitude) + - fabs(wpt->longitude - ((waypoint *) elem)->longitude)) / time_diff; + (fabs(wpt->latitude - ((waypoint*) elem)->latitude) + + fabs(wpt->longitude - ((waypoint*) elem)->longitude)) / time_diff; if (global_opts.debug_level >= 2) { printf(MYNAME ": speed=%f\n", speed); } } while (speed < 0.00003); - gnss_time = ((waypoint *) elem->next)->creation_time; + gnss_time = ((waypoint*) elem->next)->creation_time; if (global_opts.debug_level >= 1) { printf(MYNAME ": gnss landing time %s", ctime(&gnss_time)); } @@ -771,12 +771,12 @@ static int correlate_tracks(const route_head * pres_track, const route_head * gn * @param time The time that we are interested in. * @return The altitude interpolated from the track. */ -static double interpolate_alt(const route_head * track, time_t time) +static double interpolate_alt(const route_head* track, time_t time) { - static const queue *prev_elem = NULL; - static const queue *curr_elem = NULL; - const waypoint *prev_wpt; - const waypoint *curr_wpt; + static const queue* prev_elem = NULL; + static const queue* curr_elem = NULL; + const waypoint* prev_wpt; + const waypoint* curr_wpt; int time_diff; double alt_diff; @@ -785,7 +785,7 @@ static double interpolate_alt(const route_head * track, time_t time) curr_elem = prev_elem = QUEUE_FIRST(&track->waypoint_list); } // Find the track points either side of the requested time - while (((waypoint *) curr_elem)->creation_time < time) { + while (((waypoint*) curr_elem)->creation_time < time) { if (QUEUE_LAST(&track->waypoint_list) == curr_elem) { // Requested time later than all track points, we can't interpolate return unknown_alt; @@ -794,8 +794,8 @@ static double interpolate_alt(const route_head * track, time_t time) curr_elem = QUEUE_NEXT(prev_elem); } - prev_wpt = (waypoint *) prev_elem; - curr_wpt = (waypoint *) curr_elem; + prev_wpt = (waypoint*) prev_elem; + curr_wpt = (waypoint*) curr_elem; if (QUEUE_FIRST(&track->waypoint_list) == curr_elem) { if (curr_wpt->creation_time == time) { @@ -821,11 +821,11 @@ static double interpolate_alt(const route_head * track, time_t time) */ static void wr_track(void) { - const route_head *pres_track; - const route_head *gnss_track; - const waypoint *wpt; - const queue *elem; - const queue *tmp; + const route_head* pres_track; + const route_head* gnss_track; + const waypoint* wpt; + const queue* elem; + const queue* tmp; int time_adj; double pres_alt; @@ -848,7 +848,7 @@ static void wr_track(void) } // Iterate through waypoints in both tracks simultaneously QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) { - wpt = (waypoint *) elem; + wpt = (waypoint*) elem; pres_alt = interpolate_alt(pres_track, wpt->creation_time + time_adj); wr_fix_record(wpt, (int) pres_alt, (int) wpt->altitude); } @@ -857,13 +857,13 @@ static void wr_track(void) // Only the pressure altitude track was found so generate fix // records from it alone. QUEUE_FOR_EACH(&pres_track->waypoint_list, elem, tmp) { - wr_fix_record((waypoint *) elem, (int)((waypoint *) elem)->altitude, (int) unknown_alt); + wr_fix_record((waypoint*) elem, (int)((waypoint*) elem)->altitude, (int) unknown_alt); } } else if (gnss_track) { // Only the GNSS altitude track was found so generate fix // records from it alone. QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) { - wr_fix_record((waypoint *) elem, (int) unknown_alt, (int)((waypoint *) elem)->altitude); + wr_fix_record((waypoint*) elem, (int) unknown_alt, (int)((waypoint*) elem)->altitude); } } else { // No tracks found so nothing to do @@ -872,7 +872,7 @@ static void wr_track(void) } } -static void wr_init(const char *fname) +static void wr_init(const char* fname) { file_out = gbfopen(fname, "wb", MYNAME); } @@ -904,7 +904,7 @@ static arglist_t igc_args[] = { ff_vecs_t igc_vecs = { ff_type_file, - { ff_cap_none , ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write }, + { ff_cap_none , (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write) }, rd_init, wr_init, rd_deinit, diff --git a/gpsbabel/ignrando.c b/gpsbabel/ignrando.c index ec1aff1bd..ba38292b0 100644 --- a/gpsbabel/ignrando.c +++ b/gpsbabel/ignrando.c @@ -33,17 +33,17 @@ #define MYNAME "IGNRando" -static gbfile *fout; +static gbfile* fout; -static route_head *track; -static waypoint *wpt; +static route_head* track; +static waypoint* wpt; static int track_index; /* index of track we'll write */ static int track_num; /* current index of track within track_disp_all */ static int xmlpoints; /* options */ -static char *index_opt = NULL; +static char* index_opt = NULL; static arglist_t ignr_args[] = { {"index", &index_opt, "Index of track to write (if more than one in source)", NULL, ARGTYPE_INT, "1", NULL }, @@ -53,7 +53,7 @@ static arglist_t ignr_args[] = { #if ! HAVE_LIBEXPAT static void -ignr_rd_init(const char *fname) +ignr_rd_init(const char* fname) { fatal(MYNAME ": This build excluded \"" MYNAME "\" input support because expat was not installed.\n"); } @@ -85,7 +85,7 @@ xg_tag_mapping ignr_xml_map[] = { { ignr_etape_end, cb_end, "/RANDONNEE/ETAPE" }, { ignr_etape_pos, cb_cdata, "/RANDONNEE/ETAPE/POSITION" }, { ignr_etape_alt, cb_cdata, "/RANDONNEE/ETAPE/ALTITUDE" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; static void @@ -103,7 +103,7 @@ static xg_callback ignr_nb_etapes, ignr_descr; static xg_callback ignr_etape_begin, ignr_etape_end; static void -ignr_start(const char *args, const char **attrv) +ignr_start(const char* args, const char** attrv) { ignr_xml_error((track != NULL)); @@ -112,13 +112,13 @@ ignr_start(const char *args, const char **attrv) } static void -ignr_nb_etapes(const char *args, const char **attrv) +ignr_nb_etapes(const char* args, const char** attrv) { xmlpoints = atoi(args); } static void -ignr_descr(const char *args, const char **attrv) +ignr_descr(const char* args, const char** attrv) { ignr_xml_error((track == NULL)); @@ -128,7 +128,7 @@ ignr_descr(const char *args, const char **attrv) } static void -ignr_etape_begin(const char *args, const char **attrv) +ignr_etape_begin(const char* args, const char** attrv) { ignr_xml_error((wpt != NULL)); @@ -136,7 +136,7 @@ ignr_etape_begin(const char *args, const char **attrv) } static void -ignr_etape_end(const char *args, const char **attrv) +ignr_etape_end(const char* args, const char** attrv) { ignr_xml_error((track == NULL) || (wpt == NULL)); @@ -145,7 +145,7 @@ ignr_etape_end(const char *args, const char **attrv) } static void -ignr_etape_pos(const char *args, const char **attrv) +ignr_etape_pos(const char* args, const char** attrv) { ignr_xml_error((wpt == NULL) || (args == NULL)); @@ -155,7 +155,7 @@ ignr_etape_pos(const char *args, const char **attrv) } static void -ignr_etape_alt(const char *args, const char **attrv) +ignr_etape_alt(const char* args, const char** attrv) { ignr_xml_error((wpt == NULL)); if (args == NULL) { @@ -170,7 +170,7 @@ ignr_etape_alt(const char *args, const char **attrv) /* callbacks registered in ignr_vecs */ static void -ignr_rd_init(const char *fname) +ignr_rd_init(const char* fname) { xml_init(fname, ignr_xml_map, NULL); wpt = NULL; @@ -196,7 +196,7 @@ ignr_read(void) /* callbacks registered in ignr_vecs */ static void -ignr_rw_init(const char *fname) +ignr_rw_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); } @@ -208,7 +208,7 @@ ignr_rw_deinit(void) } static void -ignr_write_track_hdr(const route_head *track) +ignr_write_track_hdr(const route_head* track) { track_num++; @@ -225,12 +225,12 @@ ignr_write_track_hdr(const route_head *track) } static void -ignr_write_track_trl(const route_head *track) +ignr_write_track_trl(const route_head* track) { } static void -ignr_write_waypt(const waypoint *wpt) +ignr_write_waypt(const waypoint* wpt) { if (track_num != track_index) { return; @@ -282,7 +282,7 @@ ignr_write(void) ff_vecs_t ignr_vecs = { ff_type_file, - { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none }, + { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none }, ignr_rd_init, ignr_rw_init, ignr_rd_deinit, diff --git a/gpsbabel/igo8.c b/gpsbabel/igo8.c index ab517fc94..61c72bbdb 100644 --- a/gpsbabel/igo8.c +++ b/gpsbabel/igo8.c @@ -92,8 +92,8 @@ typedef struct _igo8_point { } igo8_point, *p_igo8_point; // Files -static gbfile *igo8_file_in; -static gbfile *igo8_file_out; +static gbfile* igo8_file_in; +static gbfile* igo8_file_out; // Options static char* igo8_option_tracknum = NULL; @@ -133,7 +133,7 @@ static void igo8_check_type_sizes() } // Reader initialization callback -static void igo8_read_init(const char *fname) +static void igo8_read_init(const char* fname) { igo8_file_in = gbfopen_le(fname, "rb", MYNAME); @@ -151,8 +151,8 @@ static void igo8_read_init(const char *fname) // Reader callback static void igo8_read(void) { - waypoint *wpt_tmp; - route_head *track_head; + waypoint* wpt_tmp; + route_head* track_head; igo8_point point; track_head = route_head_alloc(); @@ -178,7 +178,7 @@ static void igo8_read_deinit(void) } // Writer initialize callback -static void igo8_write_init(const char *fname) +static void igo8_write_init(const char* fname) { igo8_file_out = gbfopen_le(fname, "wb", MYNAME); @@ -207,7 +207,7 @@ static void igo8_write_deinit(void) } // Write point callback -static void write_igo8_track_point(const waypoint *wpt) +static void write_igo8_track_point(const waypoint* wpt) { igo8_point point; @@ -239,7 +239,7 @@ static void write_igo8_track_point(const waypoint *wpt) // Write src unicode str to the dst cstring using unicode characters // All lengths are in bytes -unsigned int print_unicode(char *dst, const unsigned int dst_max_length, short *src, unsigned int src_len) +unsigned int print_unicode(char* dst, const unsigned int dst_max_length, short* src, unsigned int src_len) { // Check to see what length we were passed, if the length doesn't include the null // then we make it include the null @@ -278,9 +278,9 @@ unsigned int print_unicode(char *dst, const unsigned int dst_max_length, short * // string, validate that the use of the CET library provides // conmforming output, remove my old junk converter code. -unsigned int ascii_to_unicode_2(char *dst, const unsigned int dst_max_length, const char *src) +unsigned int ascii_to_unicode_2(char* dst, const unsigned int dst_max_length, const char* src) { - short *unicode; + short* unicode; int len; unicode = cet_str_any_to_uni(src, &cet_cs_vec_ansi_x3_4_1968, &len); @@ -357,7 +357,7 @@ static void igo8_write(void) // Callback definitions ff_vecs_t igo8_vecs = { ff_type_file, - { ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none }, + { ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none }, igo8_read_init, igo8_write_init, igo8_read_deinit, diff --git a/gpsbabel/ik3d.c b/gpsbabel/ik3d.c index 64b64dcb2..0e46ff51f 100644 --- a/gpsbabel/ik3d.c +++ b/gpsbabel/ik3d.c @@ -29,11 +29,11 @@ static arglist_t ikt_args[] = { #define MYNAME "ikt" -static char *name, *text; +static char* name, *text; #if ! HAVE_LIBEXPAT void -ikt_rd_init(const char *fname) +ikt_rd_init(const char* fname) { fatal(MYNAME ": This build excluded \" MYNAME \" support because expat was not installed.\n"); } @@ -50,8 +50,8 @@ ikt_object_end(void) #else -static route_head *track; -static waypoint *waypt; +static route_head* track; +static waypoint* waypt; static xg_callback iktobj_waypt, iktobj_type, iktobj_name, iktobj_trkpt, iktobj_text; @@ -67,7 +67,7 @@ xg_tag_mapping ikt_map[] = { { iktobj_waypt, cb_start, IKTOBJ "_*/GeoPosition" }, { iktobj_name, cb_cdata, IKTOBJ "_*/Name" }, { iktobj_text, cb_cdata, IKTOBJ "_*/POIDrawable2D/Text" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; static void @@ -97,9 +97,9 @@ ikt_object_end(void) } static void -iktobj_waypt(const char *args, const char **attrv) +iktobj_waypt(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (strcmp(avp[0], "X") == 0) { @@ -112,9 +112,9 @@ iktobj_waypt(const char *args, const char **attrv) } static void -iktobj_trkpt(const char *args, const char **attrv) +iktobj_trkpt(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; waypt = waypt_new(); while (*avp) { @@ -130,19 +130,19 @@ iktobj_trkpt(const char *args, const char **attrv) } static void -iktobj_name(const char *args, const char **unused) +iktobj_name(const char* args, const char** unused) { name = xstrdup(args); } static void -iktobj_text(const char *args, const char **unused) +iktobj_text(const char* args, const char** unused) { text = xstrdup(args); } static void -iktobj_type(const char *args, const char **unused) +iktobj_type(const char* args, const char** unused) { ikt_object_end(); @@ -159,7 +159,7 @@ iktobj_type(const char *args, const char **unused) } static void -ikt_rd_init(const char *fname) +ikt_rd_init(const char* fname) { xml_init(fname, ikt_map, NULL); diff --git a/gpsbabel/inifile.c b/gpsbabel/inifile.c index 16a03c677..d63216b29 100644 --- a/gpsbabel/inifile.c +++ b/gpsbabel/inifile.c @@ -30,13 +30,13 @@ typedef struct inifile_entry_s { queue Q; - char *key; - char *val; + char* key; + char* val; } inifile_entry_t; typedef struct inifile_section_s { queue Q; - char *name; + char* name; int ientries; queue entries; } inifile_section_t; @@ -49,13 +49,13 @@ typedef struct inifile_section_s { #define GPSBABEL_INIFILE "gpsbabel.ini" /* Remember the filename we used so we can include it in errors. */ -char *gbinipathname; +char* gbinipathname; -static char * -find_gpsbabel_inifile(const char *path) /* can be empty or NULL */ +static char* +find_gpsbabel_inifile(const char* path) /* can be empty or NULL */ { - FILE *test; - char *buff; + FILE* test; + char* buff; int len; if (path == NULL) { @@ -87,16 +87,16 @@ find_gpsbabel_inifile(const char *path) /* can be empty or NULL */ return NULL; } -static gbfile * +static gbfile* open_gpsbabel_inifile(void) { - char *name; - char *envstr; - gbfile *res = NULL; + char* name; + char* envstr; + gbfile* res = NULL; envstr = getenv("GPSBABELINI"); if (envstr != NULL) { - FILE *test; + FILE* test; test = fopen(envstr, "r"); if (test != NULL) { @@ -118,7 +118,7 @@ open_gpsbabel_inifile(void) } #else if ((envstr = getenv("HOME")) != NULL) { - char *path; + char* path; path = (char*) xmalloc(strlen(envstr) + 11); strcpy(path, envstr); @@ -145,14 +145,14 @@ open_gpsbabel_inifile(void) } static void -inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname) +inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname) { - char *buf; - inifile_section_t *sec = NULL; + char* buf; + inifile_section_t* sec = NULL; int line = 0; while ((buf = gbfgetstr(fin))) { - char *cin = lrtrim(buf); + char* cin = lrtrim(buf); if ((line++ == 0) && fin->unicode) { inifile->unicode = 1; @@ -167,7 +167,7 @@ inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname) if (*cin == '[') { - char *cend = strchr(++cin, ']'); + char* cend = strchr(++cin, ']'); if (cend != NULL) { *cend = '\0'; @@ -177,21 +177,21 @@ inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname) fatal("%s: invalid section header '%s' in '%s'.\n", myname, cin, gbinipathname); } - sec = (inifile_section_t *) xcalloc(1, sizeof(*sec)); + sec = (inifile_section_t*) xcalloc(1, sizeof(*sec)); sec->name = xstrdup(cin); QUEUE_INIT(&sec->entries); ENQUEUE_TAIL(&inifile->secs, &sec->Q); inifile->isecs++; } else { - char *cx; - inifile_entry_t *entry; + char* cx; + inifile_entry_t* entry; if (sec == NULL) { fatal("%s: missing section header in '%s'.\n", myname,gbinipathname); } - entry = (inifile_entry_t *) xcalloc(1, sizeof(*entry)); + entry = (inifile_entry_t*) xcalloc(1, sizeof(*entry)); ENQUEUE_TAIL(&sec->entries, &entry->Q); sec->ientries++; @@ -213,23 +213,23 @@ inifile_load_file(gbfile *fin, inifile_t *inifile, const char *myname) } } -static char * -inifile_find_value(const inifile_t *inifile, const char *sec_name, const char *key) +static char* +inifile_find_value(const inifile_t* inifile, const char* sec_name, const char* key) { - queue *elem, *tmp; + queue* elem, *tmp; if (inifile == NULL) { return NULL; } QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t *sec = (inifile_section_t *) elem; + inifile_section_t* sec = (inifile_section_t*) elem; if (case_ignore_strcmp(sec->name, sec_name) == 0) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&sec->entries, elem, tmp) { - inifile_entry_t *entry = (inifile_entry_t *) elem; + inifile_entry_t* entry = (inifile_entry_t*) elem; if (case_ignore_strcmp(entry->key, key) == 0) { return entry->val; @@ -249,11 +249,11 @@ inifile_find_value(const inifile_t *inifile, const char *sec_name, const char *k filename == NULL: try to open global gpsbabel.ini */ -inifile_t * -inifile_init(const char *filename, const char *myname) +inifile_t* +inifile_init(const char* filename, const char* myname) { - inifile_t *result; - gbfile *fin = NULL; + inifile_t* result; + gbfile* fin = NULL; if (filename == NULL) { fin = open_gpsbabel_inifile(); @@ -264,7 +264,7 @@ inifile_init(const char *filename, const char *myname) fin = gbfopen(filename, "rb", myname); } - result = (inifile_t *) xcalloc(1, sizeof(*result)); + result = (inifile_t*) xcalloc(1, sizeof(*result)); QUEUE_INIT(&result->secs); inifile_load_file(fin, result, myname); @@ -273,23 +273,23 @@ inifile_init(const char *filename, const char *myname) } void -inifile_done(inifile_t *inifile) +inifile_done(inifile_t* inifile) { if (inifile == NULL) { return; } if (inifile->isecs > 0) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t *sec = (inifile_section_t *) elem; + inifile_section_t* sec = (inifile_section_t*) elem; if (sec->ientries > 0) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&sec->entries, elem, tmp) { - inifile_entry_t *entry = (inifile_entry_t *) elem; + inifile_entry_t* entry = (inifile_entry_t*) elem; if (entry->key) { xfree(entry->key); @@ -316,12 +316,12 @@ inifile_done(inifile_t *inifile) } int -inifile_has_section(const inifile_t *inifile, const char *section) +inifile_has_section(const inifile_t* inifile, const char* section) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { - inifile_section_t *sec = (inifile_section_t *) elem; + inifile_section_t* sec = (inifile_section_t*) elem; if (case_ignore_strcmp(sec->name, section) == 0) { return 1; } @@ -335,8 +335,8 @@ inifile_has_section(const inifile_t *inifile, const char *section) all key values are valid entities until "inifile_done" */ -char * -inifile_readstr(const inifile_t *inifile, const char *section, const char *key) +char* +inifile_readstr(const inifile_t* inifile, const char* section, const char* key) { return inifile_find_value(inifile, section, key); } @@ -348,9 +348,9 @@ inifile_readstr(const inifile_t *inifile, const char *section, const char *key) */ int -inifile_readint(const inifile_t *inifile, const char *section, const char *key, int *value) +inifile_readint(const inifile_t* inifile, const char* section, const char* key, int* value) { - char *str; + char* str; str = inifile_find_value(inifile, section, key); @@ -370,7 +370,7 @@ inifile_readint(const inifile_t *inifile, const char *section, const char *key, */ int -inifile_readint_def(const inifile_t *inifile, const char *section, const char *key, const int def) +inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, const int def) { int result; diff --git a/gpsbabel/inifile.h b/gpsbabel/inifile.h index 1b7ccddee..787df7cdb 100644 --- a/gpsbabel/inifile.h +++ b/gpsbabel/inifile.h @@ -34,29 +34,29 @@ typedef struct inifile_s { reads inifile filename into memory myname represents the calling module */ -inifile_t * inifile_init(const char *filename, const char *myname); -void inifile_done(inifile_t *inifile); +inifile_t* inifile_init(const char* filename, const char* myname); +void inifile_done(inifile_t* inifile); -int inifile_has_section(const inifile_t *inifile, const char *section); +int inifile_has_section(const inifile_t* inifile, const char* section); /* inifile_readstr: returns NULL if not found, otherwise a pointer to the value of key ... all key values are valid entities until "inifile_done" */ -char *inifile_readstr(const inifile_t *inifile, const char *section, const char *key); +char* inifile_readstr(const inifile_t* inifile, const char* section, const char* key); /* inifile_readint: on success the value is stored into "*value" and "inifile_readint" returns 1, otherwise inifile_readint returns 0 */ -int inifile_readint(const inifile_t *inifile, const char *section, const char *key, int *value); +int inifile_readint(const inifile_t* inifile, const char* section, const char* key, int* value); /* inifile_readint_def: if found inifile_readint_def returns value of key, otherwise a default value "def" */ -int inifile_readint_def(const inifile_t *inifile, const char *section, const char *key, const int def); +int inifile_readint_def(const inifile_t* inifile, const char* section, const char* key, const int def); #endif diff --git a/gpsbabel/interpolate.c b/gpsbabel/interpolate.c index 39a47a51b..a660ca0c0 100644 --- a/gpsbabel/interpolate.c +++ b/gpsbabel/interpolate.c @@ -26,11 +26,11 @@ #if FILTERS_ENABLED #define MYNAME "Interpolate filter" -static char *opt_interval = NULL; +static char* opt_interval = NULL; int interval = 0; -static char *opt_dist = NULL; +static char* opt_dist = NULL; double dist = 0; -static char *opt_route = NULL; +static char* opt_route = NULL; static arglist_t interpfilt_args[] = { @@ -54,9 +54,9 @@ arglist_t interpfilt_args[] = { void interpfilt_process(void) { - queue *backuproute = NULL; - queue *elem, *tmp, *elem2, *tmp2; - route_head *rte_new; + queue* backuproute = NULL; + queue* elem, *tmp, *elem2, *tmp2; + route_head* rte_new; int count = 0; int first = 0; double lat1 = 0, lon1 = 0; @@ -74,7 +74,7 @@ interpfilt_process(void) route_flush_all_tracks(); } QUEUE_FOR_EACH(backuproute, elem, tmp) { - route_head *rte_old = (route_head *)elem; + route_head* rte_old = (route_head*)elem; rte_new = route_head_alloc(); rte_new->rte_name = xstrdup(rte_old->rte_name); @@ -88,7 +88,7 @@ interpfilt_process(void) } first = 1; QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) { - waypoint *wpt = (waypoint *)elem2; + waypoint* wpt = (waypoint*)elem2; if (first) { first = 0; } else { @@ -97,7 +97,7 @@ interpfilt_process(void) for (timen = time1+interval; timen < wpt->creation_time; timen += interval) { - waypoint *wpt_new = waypt_dupe(wpt); + waypoint* wpt_new = waypt_dupe(wpt); wpt_new->creation_time = timen; if (wpt_new->shortname) { xfree(wpt_new->shortname); @@ -129,7 +129,7 @@ interpfilt_process(void) for (distn = dist; distn < curdist; distn += dist) { - waypoint *wpt_new = waypt_dupe(wpt); + waypoint* wpt_new = waypt_dupe(wpt); wpt_new->creation_time = distn/curdist* (wpt->creation_time - time1) + time1; if (wpt_new->shortname) { @@ -169,10 +169,10 @@ interpfilt_process(void) } void -interpfilt_init(const char *args) +interpfilt_init(const char* args) { - char *fm; + char* fm; if (opt_interval && opt_dist) { fatal(MYNAME ": Can't interpolate on both time and distance.\n"); } else if (opt_interval && opt_route) { diff --git a/gpsbabel/itracku.c b/gpsbabel/itracku.c index c02a0f8b8..24092284f 100644 --- a/gpsbabel/itracku.c +++ b/gpsbabel/itracku.c @@ -53,8 +53,8 @@ static waypoint* to_waypoint(itracku_data_record* d); /* itracku file access */ static void itracku_file_read_data_record(gbfile* fin, itracku_data_record* d); static gbuint32 itracku_file_read_last_time(gbfile* fin); -static void itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint *wpt)); -static void itracku_file_write_waypt(gbfile* fout, const waypoint *wpt); +static void itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint* wpt)); +static void itracku_file_write_waypt(gbfile* fout, const waypoint* wpt); /* itracku device access */ static const char read_update_data_command[] = { 0x60, 0xb5, 0, 0, 0, 0, 0 }; /* command string to start memory dump */ @@ -74,25 +74,25 @@ static char* update_data_buffer_read; static char* update_data_buffer_write; static char* update_data_buffer_end; -static void itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint *wpt)); +static void itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint* wpt)); static int itracku_device_update_data_init(); static int itracku_device_update_data_read(void* buf, int len); static void itracku_device_write_string(const char* s); static const char* itracku_device_read_string(); /* global variables */ -static void *fd; /* serial fd */ +static void* fd; /* serial fd */ static gbfile* fin; /* input file handle */ static gbfile* fout; /* output file handle */ static gbfile* fbackup; /* backup file handle */ static gbuint32 backup_last_creation_time; /* time of last data record in backup file */ static gbuint32 new_waypoint_count; /* count of new waypoints */ -static char *port; /* serial port name */ -static char *backup_file_name; /* "backup" command option */ -static char *only_new; /* "new" command option */ +static char* port; /* serial port name */ +static char* backup_file_name; /* "backup" command option */ +static char* only_new; /* "new" command option */ static void -dbg(int l, const char *msg, ...) +dbg(int l, const char* msg, ...) { va_list ap; va_start(ap, msg); @@ -361,7 +361,7 @@ arglist_t itracku_args[] = { *******************************************************************************/ static void -itracku_rd_init_common(const char *fname) +itracku_rd_init_common(const char* fname) { new_waypoint_count = 0; @@ -376,7 +376,7 @@ itracku_rd_init_common(const char *fname) } static void -itracku_rd_ser_init(const char *fname) +itracku_rd_ser_init(const char* fname) { #if LATER int i; @@ -447,7 +447,7 @@ itracku_rd_ser_init(const char *fname) } static void -itracku_rd_init(const char *fname) +itracku_rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); itracku_rd_init_common(fname); @@ -509,7 +509,7 @@ itracku_is_valid_data_record(itracku_data_record* d) } static void -itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint *wpt)) +itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint* wpt)) { itracku_data_record d; @@ -549,7 +549,7 @@ itracku_file_read_last_time(gbfile* fin) } static void -itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint *wpt)) +itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint* wpt)) { itracku_data_record d; @@ -564,7 +564,7 @@ itracku_file_read_waypts(gbfile* fin, void (*waypt_add)(waypoint *wpt)) } static void -itracku_file_write_waypt(gbfile* fout, const waypoint *wpt) +itracku_file_write_waypt(gbfile* fout, const waypoint* wpt) { itracku_data_record d; to_itracku_data_record(wpt, &d); @@ -572,7 +572,7 @@ itracku_file_write_waypt(gbfile* fout, const waypoint *wpt) } static void -itracku_waypt_input(void (*waypt_add)(waypoint *wpt)) +itracku_waypt_input(void (*waypt_add)(waypoint* wpt)) { if (fd) { itracku_device_dump_waypts(fd, waypt_add); @@ -590,7 +590,7 @@ itracku_read_waypt(void) static route_head* itracku_read_trk_track; static void -itracku_read_trk_waypt_add(waypoint *wpt) +itracku_read_trk_waypt_add(waypoint* wpt) { track_add_wpt(itracku_read_trk_track, wpt); } @@ -622,7 +622,7 @@ itracku_read(void) } static void -itracku_wr_init(const char *fname) +itracku_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); } @@ -634,7 +634,7 @@ itracku_wr_deinit(void) } static void -itracku_output_waypoint(const waypoint * wp) +itracku_output_waypoint(const waypoint* wp) { itracku_file_write_waypt(fout, wp); } @@ -651,14 +651,14 @@ itracku_exit(void) /* optional */ } static void -itracku_rt_init(const char *fname) +itracku_rt_init(const char* fname) { itracku_rd_ser_init(fname); itracku_device_write_string("WP AP-Exit"); } static void -nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds) +nmea_set_waypoint_time(waypoint* wpt, struct tm* time, int microseconds) { if (time->tm_year == 0) { wpt->creation_time = ((((time_t)time->tm_hour * 60) + time->tm_min) * 60) + time->tm_sec; @@ -675,8 +675,8 @@ nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds) } } -static waypoint * -gprmc_parse(char *ibuf) +static waypoint* +gprmc_parse(char* ibuf) { double latdeg, lngdeg; char lngdir, latdir; @@ -684,7 +684,7 @@ gprmc_parse(char *ibuf) char fix; unsigned int dmy; double speed,course; - waypoint *waypt; + waypoint* waypt; double microseconds; struct tm tm; @@ -739,8 +739,8 @@ gprmc_parse(char *ibuf) andreas.grimme@gmx.net */ -static waypoint * -itracku_rt_position(posn_status *posn_status) +static waypoint* +itracku_rt_position(posn_status* posn_status) { char line[1024]; waypoint* wpt; diff --git a/gpsbabel/jeeps/garminusb.h b/gpsbabel/jeeps/garminusb.h index 789bfc0e4..e61fa2ade 100644 --- a/gpsbabel/jeeps/garminusb.h +++ b/gpsbabel/jeeps/garminusb.h @@ -50,16 +50,16 @@ typedef struct { unsigned long serial_number; unsigned long unit_id; unsigned long unit_version; - char *os_identifier; /* In case the OS has another name for it. */ - char *product_identifier; /* From the hardware itself. */ + char* os_identifier; /* In case the OS has another name for it. */ + char* product_identifier; /* From the hardware itself. */ } garmin_unit_info_t; extern garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS]; -int gusb_cmd_send(const garmin_usb_packet *obuf, size_t sz); -int gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz); -int gusb_init(const char *portname, gpsdevh **dh); -int gusb_close(gpsdevh *); +int gusb_cmd_send(const garmin_usb_packet* obuf, size_t sz); +int gusb_cmd_get(garmin_usb_packet* ibuf, size_t sz); +int gusb_init(const char* portname, gpsdevh** dh); +int gusb_close(gpsdevh*); /* * New packet types in USB. diff --git a/gpsbabel/jeeps/gps.h b/gpsbabel/jeeps/gps.h index d2e250c71..12f30eaf2 100644 --- a/gpsbabel/jeeps/gps.h +++ b/gpsbabel/jeeps/gps.h @@ -28,200 +28,200 @@ #define ETX 0x03 - extern int32 gps_errno; - extern int32 gps_warning; - extern int32 gps_error; - extern int32 gps_user; - extern int32 gps_show_bytes; - extern char gps_categories[16][17]; - - - typedef struct GPS_SPacket { - US type; - uint32 n; - UC *data; - } GPS_OPacket, *GPS_PPacket; - - typedef struct GPS_Serial_SPacket { - UC dle; - UC type; - UC n; - UC *data; - UC chk; - UC edle; - UC etx; - } GPS_Serial_OPacket, *GPS_Serial_PPacket; - - typedef struct GPS_SProduct_Data_Type { - int16 id; - int16 version; - char desc[MAX_GPS_PACKET_SIZE]; - } GPS_OProduct_Data_Type, *GPS_PProduct_Data_Type; - - - - - typedef struct GPS_SPvt_Data_Type { - float alt; - float epe; - float eph; - float epv; - int16 fix; - double tow; - double lat; - double lon; - float east; - float north; - float up; - float msl_hght; - int16 leap_scnds; - int32 wn_days; - } GPS_OPvt_Data, *GPS_PPvt_Data; - - - - typedef struct GPS_STrack { - double lat; /* Degrees */ - double lon; /* Degrees */ - time_t Time; /* Unix time */ - float alt; /* Altitude */ - float dpth; /* Depth */ - float temperature; /* Temperature. Degrees Celsius. */ - int temperature_populated; /* True if above is valid. */ - unsigned char heartrate; /* Heartrate as in Garmin 301 */ - unsigned char cadence; /* Crank cadence as in Edge 305 */ - unsigned int wsensor_pres:1; /* Wheel sensor present */ - unsigned int tnew:1; /* New track? */ - unsigned int ishdr:1; /* Track header? */ - unsigned int no_latlon:1; /* True if no valid lat/lon found. */ - int32 dspl; /* Display on map? */ - int32 colour; /* Colour */ - float distance; /* distance traveled in meters.*/ - int distance_populated; /* True if above is valid. */ - char trk_ident[256]; /* Track identifier */ - } - GPS_OTrack, *GPS_PTrack; - - - - typedef struct GPS_SAlmanac { - UC svid; - int16 wn; - float toa; - float af0; - float af1; - float e; - float sqrta; - float m0; - float w; - float omg0; - float odot; - float i; - UC hlth; - } GPS_OAlmanac, *GPS_PAlmanac; - - - typedef struct GPS_SWay { - char ident[256]; - double lat; - double lon; - char cmnt[256]; - float dst; - int32 smbl; - int32 dspl; - char wpt_ident[256]; - char lnk_ident[256]; - UC subclass[18]; - int32 colour; - char cc[2]; - UC wpt_class; - UC alt_is_unknown; - float alt; - char city[24]; - char state[2]; - char name[30]; - char facility[32]; - char addr[52]; - char cross_road[52]; - int32 attr; - float dpth; - int32 idx; - int32 prot; - int32 isrte; - int32 rte_prot; - UC rte_num; - char rte_cmnt[20]; - char rte_ident[256]; - int32 islink; - int32 rte_link_class; - char rte_link_subclass[18]; - char rte_link_ident[256]; - - char time_populated; /* 1 if true */ - time_t time; /* Unix time */ - char temperature_populated; - float temperature; /* Degrees celsius. */ - uint16 category; - - } GPS_OWay, *GPS_PWay; - - /* - * Forerunner/Edge Lap data. - */ - typedef struct GPS_SLap { - uint32 index; /* unique index in device or -1 */ - time_t start_time; - uint32 total_time; /* Hundredths of a second */ - float total_distance; /* In meters */ - double begin_lat; - double begin_lon; - double end_lat; - double end_lon; - int16 calories; - uint32 track_index; /* ref to track or -1 */ - float max_speed; /* In meters per second */ - unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */ - unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */ - unsigned char intensity; /* Same as D1001 */ - unsigned char avg_cadence; /* In revolutions-per-minute, 0xFF if invalid */ - unsigned char trigger_method; - /*Some D1015 unknown */ - /* unsigned char unk1015_1; - int16 unk1015_2; - int16 unk1015_3; - */ - } GPS_OLap, *GPS_PLap; - - - typedef struct GPS_SCourse { - uint32 index; /* Unique among courses on device */ - char course_name[16]; /* Null-terminated unique course name */ - uint32 track_index; /* Index of the associated track +extern int32 gps_errno; +extern int32 gps_warning; +extern int32 gps_error; +extern int32 gps_user; +extern int32 gps_show_bytes; +extern char gps_categories[16][17]; + + +typedef struct GPS_SPacket { + US type; + uint32 n; + UC* data; +} GPS_OPacket, *GPS_PPacket; + +typedef struct GPS_Serial_SPacket { + UC dle; + UC type; + UC n; + UC* data; + UC chk; + UC edle; + UC etx; +} GPS_Serial_OPacket, *GPS_Serial_PPacket; + +typedef struct GPS_SProduct_Data_Type { + int16 id; + int16 version; + char desc[MAX_GPS_PACKET_SIZE]; +} GPS_OProduct_Data_Type, *GPS_PProduct_Data_Type; + + + + +typedef struct GPS_SPvt_Data_Type { + float alt; + float epe; + float eph; + float epv; + int16 fix; + double tow; + double lat; + double lon; + float east; + float north; + float up; + float msl_hght; + int16 leap_scnds; + int32 wn_days; +} GPS_OPvt_Data, *GPS_PPvt_Data; + + + +typedef struct GPS_STrack { + double lat; /* Degrees */ + double lon; /* Degrees */ + time_t Time; /* Unix time */ + float alt; /* Altitude */ + float dpth; /* Depth */ + float temperature; /* Temperature. Degrees Celsius. */ + int temperature_populated; /* True if above is valid. */ + unsigned char heartrate; /* Heartrate as in Garmin 301 */ + unsigned char cadence; /* Crank cadence as in Edge 305 */ + unsigned int wsensor_pres:1; /* Wheel sensor present */ + unsigned int tnew:1; /* New track? */ + unsigned int ishdr:1; /* Track header? */ + unsigned int no_latlon:1; /* True if no valid lat/lon found. */ + int32 dspl; /* Display on map? */ + int32 colour; /* Colour */ + float distance; /* distance traveled in meters.*/ + int distance_populated; /* True if above is valid. */ + char trk_ident[256]; /* Track identifier */ +} +GPS_OTrack, *GPS_PTrack; + + + +typedef struct GPS_SAlmanac { + UC svid; + int16 wn; + float toa; + float af0; + float af1; + float e; + float sqrta; + float m0; + float w; + float omg0; + float odot; + float i; + UC hlth; +} GPS_OAlmanac, *GPS_PAlmanac; + + +typedef struct GPS_SWay { + char ident[256]; + double lat; + double lon; + char cmnt[256]; + float dst; + int32 smbl; + int32 dspl; + char wpt_ident[256]; + char lnk_ident[256]; + UC subclass[18]; + int32 colour; + char cc[2]; + UC wpt_class; + UC alt_is_unknown; + float alt; + char city[24]; + char state[2]; + char name[30]; + char facility[32]; + char addr[52]; + char cross_road[52]; + int32 attr; + float dpth; + int32 idx; + int32 prot; + int32 isrte; + int32 rte_prot; + UC rte_num; + char rte_cmnt[20]; + char rte_ident[256]; + int32 islink; + int32 rte_link_class; + char rte_link_subclass[18]; + char rte_link_ident[256]; + + char time_populated; /* 1 if true */ + time_t time; /* Unix time */ + char temperature_populated; + float temperature; /* Degrees celsius. */ + uint16 category; + +} GPS_OWay, *GPS_PWay; + +/* + * Forerunner/Edge Lap data. + */ +typedef struct GPS_SLap { + uint32 index; /* unique index in device or -1 */ + time_t start_time; + uint32 total_time; /* Hundredths of a second */ + float total_distance; /* In meters */ + double begin_lat; + double begin_lon; + double end_lat; + double end_lon; + int16 calories; + uint32 track_index; /* ref to track or -1 */ + float max_speed; /* In meters per second */ + unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */ + unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */ + unsigned char intensity; /* Same as D1001 */ + unsigned char avg_cadence; /* In revolutions-per-minute, 0xFF if invalid */ + unsigned char trigger_method; + /*Some D1015 unknown */ + /* unsigned char unk1015_1; + int16 unk1015_2; + int16 unk1015_3; + */ +} GPS_OLap, *GPS_PLap; + + +typedef struct GPS_SCourse { + uint32 index; /* Unique among courses on device */ + char course_name[16]; /* Null-terminated unique course name */ + uint32 track_index; /* Index of the associated track * Must be 0xFFFFFFFF if there is none*/ - } GPS_OCourse, *GPS_PCourse; - - - typedef struct GPS_SCourse_Lap { - uint32 course_index; /* Index of associated course */ - uint32 lap_index; /* This lap's index in the course */ - uint32 total_time; /* In hundredths of a second */ - float total_dist; /* [m] */ - double begin_lat; /* Starting position of the lap */ - double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/ - double end_lat; /* Final position of the lap */ - double end_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/ - UC avg_heart_rate; /* In beats-per-minute, >0 */ - UC max_heart_rate; /* In beats-per-minute, >0 */ - UC intensity; /* 0=standard, active lap. +} GPS_OCourse, *GPS_PCourse; + + +typedef struct GPS_SCourse_Lap { + uint32 course_index; /* Index of associated course */ + uint32 lap_index; /* This lap's index in the course */ + uint32 total_time; /* In hundredths of a second */ + float total_dist; /* [m] */ + double begin_lat; /* Starting position of the lap */ + double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/ + double end_lat; /* Final position of the lap */ + double end_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/ + UC avg_heart_rate; /* In beats-per-minute, >0 */ + UC max_heart_rate; /* In beats-per-minute, >0 */ + UC intensity; /* 0=standard, active lap. 1=rest lap in a workout */ - UC avg_cadence; /* In revolutions-per-minute */ - } GPS_OCourse_Lap, *GPS_PCourse_Lap; - - typedef struct GPS_SCourse_Point { - char name[11]; /* Null-terminated name */ - uint32 course_index; /* Index of associated course */ - time_t track_point_time; /* Time */ - UC point_type; /* generic = 0, + UC avg_cadence; /* In revolutions-per-minute */ +} GPS_OCourse_Lap, *GPS_PCourse_Lap; + +typedef struct GPS_SCourse_Point { + char name[11]; /* Null-terminated name */ + uint32 course_index; /* Index of associated course */ + time_t track_point_time; /* Time */ + UC point_type; /* generic = 0, * summit = 1, * valley = 2, * water = 3, @@ -237,17 +237,17 @@ * first_category = 13, * hors_category = 14, * sprint = 15 */ - } GPS_OCourse_Point, *GPS_PCourse_Point; +} GPS_OCourse_Point, *GPS_PCourse_Point; - typedef struct GPS_SCourse_Limits { - uint32 max_courses; - uint32 max_course_laps; - uint32 max_course_pnt; - uint32 max_course_trk_pnt; - } GPS_OCourse_Limits, *GPS_PCourse_Limits; +typedef struct GPS_SCourse_Limits { + uint32 max_courses; + uint32 max_course_laps; + uint32 max_course_pnt; + uint32 max_course_trk_pnt; +} GPS_OCourse_Limits, *GPS_PCourse_Limits; - typedef int (*pcb_fn)(int, struct GPS_SWay **); +typedef int (*pcb_fn)(int, struct GPS_SWay**); #include "gpsdevice.h" #include "gpssend.h" @@ -263,22 +263,22 @@ #include "gpsinput.h" #include "gpsproj.h" - extern time_t gps_save_time; - extern double gps_save_lat; - extern double gps_save_lon; - extern int32 gps_save_id; - extern double gps_save_version; - extern char gps_save_string[GPS_ARB_LEN]; - extern int gps_is_usb; - - extern struct COMMANDDATA COMMAND_ID[2]; - extern struct LINKDATA LINK_ID[3]; - extern struct GPS_MODEL_PROTOCOL GPS_MP[]; - - extern char *gps_marine_sym[]; - extern char *gps_land_sym[]; - extern char *gps_aviation_sym[]; - extern char *gps_16_sym[]; +extern time_t gps_save_time; +extern double gps_save_lat; +extern double gps_save_lon; +extern int32 gps_save_id; +extern double gps_save_version; +extern char gps_save_string[GPS_ARB_LEN]; +extern int gps_is_usb; + +extern struct COMMANDDATA COMMAND_ID[2]; +extern struct LINKDATA LINK_ID[3]; +extern struct GPS_MODEL_PROTOCOL GPS_MP[]; + +extern char* gps_marine_sym[]; +extern char* gps_land_sym[]; +extern char* gps_aviation_sym[]; +extern char* gps_16_sym[]; #endif diff --git a/gpsbabel/jeeps/gpsapp.c b/gpsbabel/jeeps/gpsapp.c index 293d8bfe2..b21761b7b 100644 --- a/gpsbabel/jeeps/gpsapp.c +++ b/gpsbabel/jeeps/gpsapp.c @@ -43,70 +43,70 @@ double gps_save_lon; #define XMIN(a,b) (a < b? a : b) -static int32 GPS_A000(const char *port); +static int32 GPS_A000(const char* port); static void GPS_A001(GPS_PPacket packet); -static void GPS_A500_Translate(UC *s, GPS_PAlmanac *alm); -static void GPS_A500_Encode(UC *s, GPS_PAlmanac alm); -static void GPS_A300_Translate(UC *s, GPS_PTrack *trk); -static void GPS_A300_Encode(UC *s, GPS_PTrack trk); - - -static void GPS_D100_Get(GPS_PWay *way, UC *s); -static void GPS_D101_Get(GPS_PWay *way, UC *s); -static void GPS_D102_Get(GPS_PWay *way, UC *s); -static void GPS_D103_Get(GPS_PWay *way, UC *s); -static void GPS_D104_Get(GPS_PWay *way, UC *s); -static void GPS_D105_Get(GPS_PWay *way, UC *s); -static void GPS_D106_Get(GPS_PWay *way, UC *s); -static void GPS_D107_Get(GPS_PWay *way, UC *s); -static void GPS_D108_Get(GPS_PWay *way, UC *s); -static void GPS_D109_Get(GPS_PWay *way, UC *s, int proto); -static void GPS_D150_Get(GPS_PWay *way, UC *s); -static void GPS_D151_Get(GPS_PWay *way, UC *s); -static void GPS_D152_Get(GPS_PWay *way, UC *s); -static void GPS_D154_Get(GPS_PWay *way, UC *s); -static void GPS_D155_Get(GPS_PWay *way, UC *s); - -static void GPS_D100_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D101_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D102_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D103_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D104_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D107_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int proto); -static void GPS_D150_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D151_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D152_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D154_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D155_Send(UC *data, GPS_PWay way, int32 *len); - -static void GPS_D120_Get(int n, char *data); - -static void GPS_D200_Get(GPS_PWay *way, UC *s); -static void GPS_D201_Get(GPS_PWay *way, UC *s); -static void GPS_D202_Get(GPS_PWay *way, UC *s); -static void GPS_D210_Get(GPS_PWay *way, UC *s); -static void GPS_D200_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D201_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D202_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len); - -static void GPS_D400_Get(GPS_PWay *way, UC *s); -static void GPS_D403_Get(GPS_PWay *way, UC *s); -static void GPS_D450_Get(GPS_PWay *way, UC *s); -static void GPS_D400_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D403_Send(UC *data, GPS_PWay way, int32 *len); -static void GPS_D450_Send(UC *data, GPS_PWay way, int32 *len); - -static void GPS_D500_Send(UC *data, GPS_PAlmanac alm); -static void GPS_D501_Send(UC *data, GPS_PAlmanac alm); -static void GPS_D550_Send(UC *data, GPS_PAlmanac alm); -static void GPS_D551_Send(UC *data, GPS_PAlmanac alm); +static void GPS_A500_Translate(UC* s, GPS_PAlmanac* alm); +static void GPS_A500_Encode(UC* s, GPS_PAlmanac alm); +static void GPS_A300_Translate(UC* s, GPS_PTrack* trk); +static void GPS_A300_Encode(UC* s, GPS_PTrack trk); + + +static void GPS_D100_Get(GPS_PWay* way, UC* s); +static void GPS_D101_Get(GPS_PWay* way, UC* s); +static void GPS_D102_Get(GPS_PWay* way, UC* s); +static void GPS_D103_Get(GPS_PWay* way, UC* s); +static void GPS_D104_Get(GPS_PWay* way, UC* s); +static void GPS_D105_Get(GPS_PWay* way, UC* s); +static void GPS_D106_Get(GPS_PWay* way, UC* s); +static void GPS_D107_Get(GPS_PWay* way, UC* s); +static void GPS_D108_Get(GPS_PWay* way, UC* s); +static void GPS_D109_Get(GPS_PWay* way, UC* s, int proto); +static void GPS_D150_Get(GPS_PWay* way, UC* s); +static void GPS_D151_Get(GPS_PWay* way, UC* s); +static void GPS_D152_Get(GPS_PWay* way, UC* s); +static void GPS_D154_Get(GPS_PWay* way, UC* s); +static void GPS_D155_Get(GPS_PWay* way, UC* s); + +static void GPS_D100_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D101_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D102_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D103_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D104_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D105_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D106_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D107_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D108_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D109_Send(UC* data, GPS_PWay way, int32* len, int proto); +static void GPS_D150_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D151_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D152_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D154_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D155_Send(UC* data, GPS_PWay way, int32* len); + +static void GPS_D120_Get(int n, char* data); + +static void GPS_D200_Get(GPS_PWay* way, UC* s); +static void GPS_D201_Get(GPS_PWay* way, UC* s); +static void GPS_D202_Get(GPS_PWay* way, UC* s); +static void GPS_D210_Get(GPS_PWay* way, UC* s); +static void GPS_D200_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D201_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D202_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D210_Send(UC* data, GPS_PWay way, int32* len); + +static void GPS_D400_Get(GPS_PWay* way, UC* s); +static void GPS_D403_Get(GPS_PWay* way, UC* s); +static void GPS_D450_Get(GPS_PWay* way, UC* s); +static void GPS_D400_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D403_Send(UC* data, GPS_PWay way, int32* len); +static void GPS_D450_Send(UC* data, GPS_PWay way, int32* len); + +static void GPS_D500_Send(UC* data, GPS_PAlmanac alm); +static void GPS_D501_Send(UC* data, GPS_PAlmanac alm); +static void GPS_D550_Send(UC* data, GPS_PAlmanac alm); +static void GPS_D551_Send(UC* data, GPS_PAlmanac alm); static UC Is_Trackpoint_Invalid(GPS_PTrack trk); @@ -125,9 +125,9 @@ char gps_save_string[GPS_ARB_LEN]; typedef enum { UpperNo = 0, UpperYes = 1 } copycase; static -void copy_char_array(UC **dst, char* src, int count, copycase mustupper) +void copy_char_array(UC** dst, char* src, int count, copycase mustupper) { - UC *d = *dst; + UC* d = *dst; int ocount = count; do { UC sc = *src++; @@ -158,7 +158,7 @@ void copy_char_array(UC **dst, char* src, int count, copycase mustupper) ** ** @return [int32] 1 if success -ve if error ************************************************************************/ -int32 GPS_Init(const char *port) +int32 GPS_Init(const char* port) { int32 ret; @@ -195,9 +195,9 @@ int32 GPS_Init(const char *port) ** ** @return [int32] 1 if success -ve if error ************************************************************************/ -static int32 GPS_A000(const char *port) +static int32 GPS_A000(const char* port) { - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int16 version; @@ -230,7 +230,7 @@ static int32 GPS_A000(const char *port) id = GPS_Util_Get_Short(rec->data); version = GPS_Util_Get_Short((rec->data)+2); - (void) strcpy(gps_save_string,(char *)rec->data+4); + (void) strcpy(gps_save_string,(char*)rec->data+4); gps_save_id = id; gps_save_version = (double)((double)version/(double)100.); @@ -386,7 +386,7 @@ static void GPS_A001(GPS_PPacket packet) { int32 entries; int32 i; - UC *p; + UC* p; US tag; US data; US lasta=0; @@ -859,10 +859,10 @@ static void GPS_A001(GPS_PPacket packet) ** ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *)) +int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int, GPS_PWay*)) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -898,7 +898,7 @@ int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *)) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) { + if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) { GPS_Error("A100_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -1016,10 +1016,10 @@ int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int, GPS_PWay *)) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay *)) +int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)(GPS_PWay*)) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -1047,7 +1047,7 @@ int32 GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay for (i=0; idata); + GPS_D120_Get(i,(char*) rec->data); break; } } @@ -1224,9 +1224,9 @@ int32 GPS_A101_Get(const char *port) ** ** @return [void] ************************************************************************/ -static void GPS_D100_Get(GPS_PWay *way, UC *s) +static void GPS_D100_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1262,9 +1262,9 @@ static void GPS_D100_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D101_Get(GPS_PWay *way, UC *s) +static void GPS_D101_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1305,9 +1305,9 @@ static void GPS_D101_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D102_Get(GPS_PWay *way, UC *s) +static void GPS_D102_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1349,9 +1349,9 @@ static void GPS_D102_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D103_Get(GPS_PWay *way, UC *s) +static void GPS_D103_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1391,9 +1391,9 @@ static void GPS_D103_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D104_Get(GPS_PWay *way, UC *s) +static void GPS_D104_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1437,10 +1437,10 @@ static void GPS_D104_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D105_Get(GPS_PWay *way, UC *s) +static void GPS_D105_Get(GPS_PWay* way, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; p=s; @@ -1455,7 +1455,7 @@ static void GPS_D105_Get(GPS_PWay *way, UC *s) (*way)->smbl = GPS_Util_Get_Short(p); p+=sizeof(int16); - q = (UC *)(*way)->wpt_ident; + q = (UC*)(*way)->wpt_ident; while ((*q++ = *p++)); return; @@ -1472,10 +1472,10 @@ static void GPS_D105_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -void GPS_D106_Get(GPS_PWay *way, UC *s) +void GPS_D106_Get(GPS_PWay* way, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; p=s; @@ -1497,9 +1497,9 @@ void GPS_D106_Get(GPS_PWay *way, UC *s) (*way)->smbl = GPS_Util_Get_Short(p); p+=sizeof(int16); - q = (UC *)(*way)->wpt_ident; + q = (UC*)(*way)->wpt_ident; while ((*q++ = *p++)); - q = (UC *)(*way)->lnk_ident; + q = (UC*)(*way)->lnk_ident; while ((*q++ = *p++)); return; @@ -1516,9 +1516,9 @@ void GPS_D106_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D107_Get(GPS_PWay *way, UC *s) +static void GPS_D107_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1562,10 +1562,10 @@ static void GPS_D107_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D108_Get(GPS_PWay *way, UC *s) +static void GPS_D108_Get(GPS_PWay* way, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; @@ -1603,22 +1603,22 @@ static void GPS_D108_Get(GPS_PWay *way, UC *s) (*way)->cc[i] = *p++; } - q = (UC *)(*way)->ident; + q = (UC*)(*way)->ident; while ((*q++ = *p++)); - q = (UC *)(*way)->cmnt; + q = (UC*)(*way)->cmnt; while ((*q++ = *p++)); - q = (UC *)(*way)->facility; + q = (UC*)(*way)->facility; while ((*q++ = *p++)); - q = (UC *)(*way)->city; + q = (UC*)(*way)->city; while ((*q++ = *p++)); - q = (UC *)(*way)->addr; + q = (UC*)(*way)->addr; while ((*q++ = *p++)); - q = (UC *)(*way)->cross_road; + q = (UC*)(*way)->cross_road; while ((*q++ = *p++)); return; @@ -1636,10 +1636,10 @@ static void GPS_D108_Get(GPS_PWay *way, UC *s) ** of temp, time, and wpt_cat stuck between ete and ident. Rather than ** duplicating the function, we just handle this at runtime. ************************************************************************/ -static void GPS_D109_Get(GPS_PWay *way, UC *s, int protoid) +static void GPS_D109_Get(GPS_PWay* way, UC* s, int protoid) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; @@ -1702,22 +1702,22 @@ static void GPS_D109_Get(GPS_PWay *way, UC *s, int protoid) p += 2; } - q = (UC *)(*way)->ident; + q = (UC*)(*way)->ident; while ((*q++ = *p++)); - q = (UC *)(*way)->cmnt; + q = (UC*)(*way)->cmnt; while ((*q++ = *p++)); - q = (UC *)(*way)->facility; + q = (UC*)(*way)->facility; while ((*q++ = *p++)); - q = (UC *)(*way)->city; + q = (UC*)(*way)->city; while ((*q++ = *p++)); - q = (UC *)(*way)->addr; + q = (UC*)(*way)->addr; while ((*q++ = *p++)); - q = (UC *)(*way)->cross_road; + q = (UC*)(*way)->cross_road; while ((*q++ = *p++)); return; @@ -1733,9 +1733,9 @@ static void GPS_D109_Get(GPS_PWay *way, UC *s, int protoid) ** ** @return [void] ************************************************************************/ -static void GPS_D150_Get(GPS_PWay *way, UC *s) +static void GPS_D150_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1785,9 +1785,9 @@ static void GPS_D150_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D151_Get(GPS_PWay *way, UC *s) +static void GPS_D151_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1847,9 +1847,9 @@ static void GPS_D151_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D152_Get(GPS_PWay *way, UC *s) +static void GPS_D152_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1908,9 +1908,9 @@ static void GPS_D152_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D154_Get(GPS_PWay *way, UC *s) +static void GPS_D154_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -1971,9 +1971,9 @@ static void GPS_D154_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D155_Get(GPS_PWay *way, UC *s) +static void GPS_D155_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -2037,7 +2037,7 @@ char gps_categories[16][17]; * Read descriptor s into category number N; */ static -void GPS_D120_Get(int cat_num, char *s) +void GPS_D120_Get(int cat_num, char* s) { /* we're guaranteed to have no more than 16 chars plus a * null terminator. @@ -2065,9 +2065,9 @@ void GPS_D120_Get(int cat_num, char *s) ** ** @return [void] ************************************************************************/ -static void GPS_D100_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D100_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2096,9 +2096,9 @@ static void GPS_D100_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D101_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D101_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2133,9 +2133,9 @@ static void GPS_D101_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D102_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D102_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2169,9 +2169,9 @@ static void GPS_D102_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D103_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D103_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2204,9 +2204,9 @@ static void GPS_D103_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D104_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D104_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2247,10 +2247,10 @@ static void GPS_D104_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D105_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; p = data; @@ -2262,7 +2262,7 @@ static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len) GPS_Util_Put_Short(p, (int16) way->smbl); p+=sizeof(int16); - q = (UC *) way->wpt_ident; + q = (UC*) way->wpt_ident; while ((*p++ = *q++)); @@ -2282,10 +2282,10 @@ static void GPS_D105_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D106_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; p = data; @@ -2302,9 +2302,9 @@ static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len) GPS_Util_Put_Short(p, (int16) way->smbl); p+=sizeof(int16); - q = (UC *) way->wpt_ident; + q = (UC*) way->wpt_ident; while ((*p++ = *q++)); - q = (UC *) way->lnk_ident; + q = (UC*) way->lnk_ident; while ((*p++ = *q++)); *len = p-data; @@ -2323,9 +2323,9 @@ static void GPS_D106_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D107_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D107_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2363,10 +2363,10 @@ static void GPS_D107_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D108_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; @@ -2405,22 +2405,22 @@ static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len) } - q = (UC *) way->ident; + q = (UC*) way->ident; i = XMIN(51, sizeof(way->ident)); while ((*p++ = *q++) && i--); - q = (UC *) way->cmnt; + q = (UC*) way->cmnt; i = XMIN(51, sizeof(way->cmnt)); while ((*p++ = *q++) && i--); - q = (UC *) way->facility; + q = (UC*) way->facility; i = XMIN(31, sizeof(way->facility)); while ((*p++ = *q++) && i--); - q = (UC *) way->city; + q = (UC*) way->city; i = XMIN(25, sizeof(way->city)); while ((*p++ = *q++) && i--); - q = (UC *) way->addr; + q = (UC*) way->addr; i = XMIN(51, sizeof(way->addr)); while ((*p++ = *q++) && i--); - q = (UC *) way->cross_road; + q = (UC*) way->cross_road; i = XMIN(51, sizeof(way->cross_road)); while ((*p++ = *q++) && i--); @@ -2441,10 +2441,10 @@ static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len) ** @return [void] ** D109's and D110's are so simlar, we handle themw with the same code. ************************************************************************/ -static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int protoid) +static void GPS_D109_Send(UC* data, GPS_PWay way, int32* len, int protoid) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; @@ -2510,22 +2510,22 @@ static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int protoid) p += 2; } - q = (UC *) way->ident; + q = (UC*) way->ident; i = XMIN(51, sizeof(way->ident)); while ((*p++ = *q++) && i--); - q = (UC *) way->cmnt; + q = (UC*) way->cmnt; i = XMIN(51, sizeof(way->cmnt)); while ((*p++ = *q++) && i--); - q = (UC *) way->facility; + q = (UC*) way->facility; i = XMIN(31, sizeof(way->facility)); while ((*p++ = *q++) && i--); - q = (UC *) way->city; + q = (UC*) way->city; i = XMIN(25, sizeof(way->city)); while ((*p++ = *q++) && i--); - q = (UC *) way->addr; + q = (UC*) way->addr; i = XMIN(51, sizeof(way->addr)); while ((*p++ = *q++) && i--); - q = (UC *) way->cross_road; + q = (UC*) way->cross_road; i = XMIN(51, sizeof(way->cross_road)); while ((*p++ = *q++) && i--); *len = p-data; @@ -2543,9 +2543,9 @@ static void GPS_D109_Send(UC *data, GPS_PWay way, int32 *len, int protoid) ** ** @return [void] ************************************************************************/ -static void GPS_D150_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D150_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -2589,9 +2589,9 @@ static void GPS_D150_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D151_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D151_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -2642,9 +2642,9 @@ static void GPS_D151_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D152_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D152_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -2694,9 +2694,9 @@ static void GPS_D152_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D154_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D154_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -2750,9 +2750,9 @@ static void GPS_D154_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D155_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D155_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -2802,10 +2802,10 @@ static void GPS_D155_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_A200_Get(const char *port, GPS_PWay **way) +int32 GPS_A200_Get(const char* port, GPS_PWay** way) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -2841,7 +2841,7 @@ int32 GPS_A200_Get(const char *port, GPS_PWay **way) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) { + if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) { GPS_Error("A200_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -2981,10 +2981,10 @@ int32 GPS_A200_Get(const char *port, GPS_PWay **way) ** ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_A201_Get(const char *port, GPS_PWay **way) +int32 GPS_A201_Get(const char* port, GPS_PWay** way) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -3020,7 +3020,7 @@ int32 GPS_A201_Get(const char *port, GPS_PWay **way) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) { + if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) { GPS_Error("A201_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -3177,10 +3177,10 @@ int32 GPS_A201_Get(const char *port, GPS_PWay **way) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A200_Send(const char *port, GPS_PWay *way, int32 n) +int32 GPS_A200_Send(const char* port, GPS_PWay* way, int32 n) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -3323,10 +3323,10 @@ int32 GPS_A200_Send(const char *port, GPS_PWay *way, int32 n) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A201_Send(const char *port, GPS_PWay *way, int32 n) +int32 GPS_A201_Send(const char* port, GPS_PWay* way, int32 n) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -3487,7 +3487,7 @@ int32 GPS_A201_Send(const char *port, GPS_PWay *way, int32 n) ** ** @return [void] ************************************************************************/ -static void GPS_D200_Get(GPS_PWay *way, UC *s) +static void GPS_D200_Get(GPS_PWay* way, UC* s) { (*way)->rte_prot = 200; (*way)->rte_num = *s; @@ -3507,9 +3507,9 @@ static void GPS_D200_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D201_Get(GPS_PWay *way, UC *s) +static void GPS_D201_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -3535,10 +3535,10 @@ static void GPS_D201_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D202_Get(GPS_PWay *way, UC *s) +static void GPS_D202_Get(GPS_PWay* way, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; p=s; @@ -3548,7 +3548,7 @@ static void GPS_D202_Get(GPS_PWay *way, UC *s) (*way)->rte_num = *p++; #endif (*way)->isrte = 1; - q = (UC *)(*way)->rte_ident; + q = (UC*)(*way)->rte_ident; while ((*q++=*p++)); return; @@ -3565,10 +3565,10 @@ static void GPS_D202_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D210_Get(GPS_PWay *way, UC *s) +static void GPS_D210_Get(GPS_PWay* way, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; p=s; @@ -3578,7 +3578,7 @@ static void GPS_D210_Get(GPS_PWay *way, UC *s) for (i=0; i<18; ++i) { (*way)->rte_link_subclass[i] = *p++; } - q = (UC *)(*way)->rte_link_ident; + q = (UC*)(*way)->rte_link_ident; while ((*q++=*p++)); return; @@ -3596,7 +3596,7 @@ static void GPS_D210_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D200_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D200_Send(UC* data, GPS_PWay way, int32* len) { *data = way->rte_num; @@ -3617,9 +3617,9 @@ static void GPS_D200_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D201_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D201_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; p = data; @@ -3642,13 +3642,13 @@ static void GPS_D201_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D202_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D202_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; p = data; - q = (UC *) way->rte_ident; + q = (UC*) way->rte_ident; while ((*p++ = *q++)); @@ -3669,10 +3669,10 @@ static void GPS_D202_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D210_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; p = data; @@ -3683,7 +3683,7 @@ static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len) *p++ = way->rte_link_subclass[i]; } - q = (UC *) way->rte_link_ident; + q = (UC*) way->rte_link_ident; while ((*p++ = *q++)); *len = p-data; @@ -3702,10 +3702,10 @@ static void GPS_D210_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [int32] number of track entries ************************************************************************/ -int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb) +int32 GPS_A300_Get(const char* port, GPS_PTrack** trk, pcb_fn cb) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -3752,7 +3752,7 @@ int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*trk)=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack)))) { + if (!((*trk)=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack)))) { GPS_Error("A300_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -3800,7 +3800,7 @@ int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb) * Hopefully, this won't be needed forever. */ int -drain_run_cmd(gpsdevh *fd) +drain_run_cmd(gpsdevh* fd) { GPS_PPacket tra; GPS_PPacket rec; @@ -3849,10 +3849,10 @@ drain_run_cmd(gpsdevh *fd) ** ** @return [int32] number of track entries ************************************************************************/ -int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid) +int32 GPS_A301_Get(const char* port, GPS_PTrack** trk, pcb_fn cb, int protoid) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -3923,7 +3923,7 @@ int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*trk)=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack)))) { + if (!((*trk)=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack)))) { GPS_Error("A301_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -4036,10 +4036,10 @@ int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n) +int32 GPS_A300_Send(const char* port, GPS_PTrack* trk, int32 n) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -4135,8 +4135,8 @@ int32 GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid, - gpsdevh *fd) +int32 GPS_A301_Send(const char* port, GPS_PTrack* trk, int32 n, int protoid, + gpsdevh* fd) { UC data[GPS_ARB_LEN]; GPS_PPacket tra; @@ -4281,7 +4281,7 @@ int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid, ** ** @return [int32] number of entries read ************************************************************************/ -int32 GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *fd) +int32 GPS_D300_Get(GPS_PTrack* trk, int32 entries, gpsdevh* fd) { GPS_PPacket tra; GPS_PPacket rec; @@ -4334,7 +4334,7 @@ int32 GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *fd) ** ** @return [void] ************************************************************************/ -void GPS_D300b_Get(GPS_PTrack *trk, UC *data) +void GPS_D300b_Get(GPS_PTrack* trk, UC* data) { GPS_A300_Translate(data, trk); @@ -4352,9 +4352,9 @@ void GPS_D300b_Get(GPS_PTrack *trk, UC *data) ** ** @return [void] ************************************************************************/ -void GPS_D301b_Get(GPS_PTrack *trk, UC *data) +void GPS_D301b_Get(GPS_PTrack* trk, UC* data) { - UC *p; + UC* p; uint32 t; p=data; @@ -4393,9 +4393,9 @@ void GPS_D301b_Get(GPS_PTrack *trk, UC *data) ** ** @return [void] ************************************************************************/ -void GPS_D302b_Get(GPS_PTrack *trk, UC *data) +void GPS_D302b_Get(GPS_PTrack* trk, UC* data) { - UC *p; + UC* p; uint32 t; double gps_temp; @@ -4447,9 +4447,9 @@ void GPS_D302b_Get(GPS_PTrack *trk, UC *data) ** ** @return [void] ************************************************************************/ -void GPS_D303b_Get(GPS_PTrack *trk, UC *data) +void GPS_D303b_Get(GPS_PTrack* trk, UC* data) { - UC *p; + UC* p; uint32 t; uint32 raw_lat, raw_lon; int lat_undefined, lon_undefined; @@ -4540,17 +4540,17 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *data) ** ** @return [void] ************************************************************************/ -void GPS_D310_Get(GPS_PTrack *trk, UC *s) +void GPS_D310_Get(GPS_PTrack* trk, UC* s) { - UC *p; - UC *q; + UC* p; + UC* q; p=s; (*trk)->dspl = *p++; (*trk)->colour = *p++; - q = (UC *)(*trk)->trk_ident; + q = (UC*)(*trk)->trk_ident; while ((*q++ = *p++)); @@ -4566,9 +4566,9 @@ void GPS_D310_Get(GPS_PTrack *trk, UC *s) ** ** @return [void] ************************************************************************/ -void GPS_D311_Get(GPS_PTrack *trk, UC *s) +void GPS_D311_Get(GPS_PTrack* trk, UC* s) { - UC *p; + UC* p; short identifier; p=s; @@ -4591,9 +4591,9 @@ void GPS_D311_Get(GPS_PTrack *trk, UC *s) ** ** @return [void] ************************************************************************/ -void GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len) +void GPS_D300_Send(UC* data, GPS_PTrack trk, int32* len) { - UC *p; + UC* p; p = data; GPS_A300_Encode(p,trk); @@ -4616,9 +4616,9 @@ void GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len) ** ** @return [void] ************************************************************************/ -void GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type) +void GPS_D301_Send(UC* data, GPS_PTrack trk, int32* len, int type) { - UC *p; + UC* p; p = data; GPS_A300_Encode(p,trk); @@ -4655,9 +4655,9 @@ void GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type) ** ** @return [void] ************************************************************************/ -void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid) +void GPS_D303_Send(UC* data, GPS_PTrack trk, int32* len, int protoid) { - UC *p; + UC* p; p = data; GPS_A300_Encode(p,trk); @@ -4697,9 +4697,9 @@ void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid) ** ** @return [void] ************************************************************************/ -void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len) +void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len) { - UC *p; + UC* p; p = data; GPS_Util_Put_Short(p,strtoul(trk->trk_ident, NULL, 0)); @@ -4719,17 +4719,17 @@ void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len) ** ** @return [void] ************************************************************************/ -void GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len) +void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len) { - UC *p; - UC *q; + UC* p; + UC* q; p = data; *p++ = trk->dspl; *p++ = trk->colour; - q = (UC *) trk->trk_ident; + q = (UC*) trk->trk_ident; while ((*p++ = *q++)); *len = p-data; @@ -4747,9 +4747,9 @@ void GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_A300_Translate(UC *s, GPS_PTrack *trk) +static void GPS_A300_Translate(UC* s, GPS_PTrack* trk) { - UC *p; + UC* p; uint32 t; p=s; @@ -4784,9 +4784,9 @@ static void GPS_A300_Translate(UC *s, GPS_PTrack *trk) ** ** @return [void] ************************************************************************/ -static void GPS_A300_Encode(UC *s, GPS_PTrack trk) +static void GPS_A300_Encode(UC* s, GPS_PTrack trk) { - UC *p; + UC* p; p=s; @@ -4818,10 +4818,10 @@ static void GPS_A300_Encode(UC *s, GPS_PTrack trk) ** ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_A400_Get(const char *port, GPS_PWay **way) +int32 GPS_A400_Get(const char* port, GPS_PWay** way) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 n; @@ -4875,7 +4875,7 @@ int32 GPS_A400_Get(const char *port, GPS_PWay **way) n = GPS_Util_Get_Short(rec->data); if (n) - if (!((*way)=(GPS_PWay *)malloc(n*sizeof(GPS_PWay)))) { + if (!((*way)=(GPS_PWay*)malloc(n*sizeof(GPS_PWay)))) { GPS_Error("A400_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -4989,10 +4989,10 @@ int32 GPS_A400_Get(const char *port, GPS_PWay **way) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A400_Send(const char *port, GPS_PWay *way, int32 n) +int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -5117,9 +5117,9 @@ int32 GPS_A400_Send(const char *port, GPS_PWay *way, int32 n) ** ** @return [void] ************************************************************************/ -static void GPS_D400_Get(GPS_PWay *way, UC *s) +static void GPS_D400_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -5157,9 +5157,9 @@ static void GPS_D400_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D403_Get(GPS_PWay *way, UC *s) +static void GPS_D403_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -5199,9 +5199,9 @@ static void GPS_D403_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D450_Get(GPS_PWay *way, UC *s) +static void GPS_D450_Get(GPS_PWay* way, UC* s) { - UC *p; + UC* p; int32 i; p=s; @@ -5257,9 +5257,9 @@ static void GPS_D450_Get(GPS_PWay *way, UC *s) ** ** @return [void] ************************************************************************/ -static void GPS_D400_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D400_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -5295,9 +5295,9 @@ static void GPS_D400_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D403_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D403_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -5336,9 +5336,9 @@ static void GPS_D403_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [void] ************************************************************************/ -static void GPS_D450_Send(UC *data, GPS_PWay way, int32 *len) +static void GPS_D450_Send(UC* data, GPS_PWay way, int32* len) { - UC *p; + UC* p; int32 i; p = data; @@ -5394,10 +5394,10 @@ static void GPS_D450_Send(UC *data, GPS_PWay way, int32 *len) ** ** @return [int32] number of almanac entries ************************************************************************/ -int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm) +int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; int32 i, n; @@ -5434,7 +5434,7 @@ int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm) n = GPS_Util_Get_Short(recpkt->data); if (n) - if (!((*alm)=(GPS_PAlmanac *)malloc(n*sizeof(GPS_PAlmanac)))) { + if (!((*alm)=(GPS_PAlmanac*)malloc(n*sizeof(GPS_PAlmanac)))) { GPS_Error("A500_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -5513,10 +5513,10 @@ int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n) +int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n) { UC data[GPS_ARB_LEN]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 i; @@ -5696,9 +5696,9 @@ int32 GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n) ** ** @return [void] ************************************************************************/ -static void GPS_A500_Translate(UC *s, GPS_PAlmanac *alm) +static void GPS_A500_Translate(UC* s, GPS_PAlmanac* alm) { - UC *p; + UC* p; p=s; @@ -5748,9 +5748,9 @@ static void GPS_A500_Translate(UC *s, GPS_PAlmanac *alm) ** ** @return [void] ************************************************************************/ -static void GPS_D500_Send(UC *data, GPS_PAlmanac alm) +static void GPS_D500_Send(UC* data, GPS_PAlmanac alm) { - UC *p; + UC* p; p = data; GPS_A500_Encode(p,alm); @@ -5769,9 +5769,9 @@ static void GPS_D500_Send(UC *data, GPS_PAlmanac alm) ** ** @return [void] ************************************************************************/ -static void GPS_D501_Send(UC *data, GPS_PAlmanac alm) +static void GPS_D501_Send(UC* data, GPS_PAlmanac alm) { - UC *p; + UC* p; p=data; p[42] = alm->hlth; @@ -5791,9 +5791,9 @@ static void GPS_D501_Send(UC *data, GPS_PAlmanac alm) ** ** @return [void] ************************************************************************/ -static void GPS_D550_Send(UC *data, GPS_PAlmanac alm) +static void GPS_D550_Send(UC* data, GPS_PAlmanac alm) { - UC *p; + UC* p; p = data; *p = alm->svid; @@ -5813,9 +5813,9 @@ static void GPS_D550_Send(UC *data, GPS_PAlmanac alm) ** ** @return [void] ************************************************************************/ -static void GPS_D551_Send(UC *data, GPS_PAlmanac alm) +static void GPS_D551_Send(UC* data, GPS_PAlmanac alm) { - UC *p; + UC* p; p = data; *p = alm->svid; @@ -5836,9 +5836,9 @@ static void GPS_D551_Send(UC *data, GPS_PAlmanac alm) ** ** @return [void] ************************************************************************/ -static void GPS_A500_Encode(UC *s, GPS_PAlmanac alm) +static void GPS_A500_Encode(UC* s, GPS_PAlmanac alm) { - UC *p; + UC* p; p=s; @@ -5886,10 +5886,10 @@ static void GPS_A500_Encode(UC *s, GPS_PAlmanac alm) ** ** @return [time_t] GPS time as unix system time, -ve if error ************************************************************************/ -time_t GPS_A600_Get(const char *port) +time_t GPS_A600_Get(const char* port) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; time_t ret; @@ -5952,9 +5952,9 @@ time_t GPS_A600_Get(const char *port) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A600_Send(const char *port, time_t Time) +int32 GPS_A600_Send(const char* port, time_t Time) { - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; int32 posnsent=0; @@ -6044,7 +6044,7 @@ int32 GPS_A600_Send(const char *port, time_t Time) ************************************************************************/ time_t GPS_D600_Get(GPS_PPacket packet) { - UC *p; + UC* p; static struct tm ts; p = packet->data; @@ -6071,11 +6071,11 @@ time_t GPS_D600_Get(GPS_PPacket packet) ** ** @return [void] ************************************************************************/ -void GPS_D600_Send(GPS_PPacket *packet, time_t Time) +void GPS_D600_Send(GPS_PPacket* packet, time_t Time) { UC data[10]; - UC *p; - struct tm *ts; + UC* p; + struct tm* ts; p = data; @@ -6110,10 +6110,10 @@ void GPS_D600_Send(GPS_PPacket *packet, time_t Time) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A700_Get(const char *port, double *lat, double *lon) +int32 GPS_A700_Get(const char* port, double* lat, double* lon) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; @@ -6175,9 +6175,9 @@ int32 GPS_A700_Get(const char *port, double *lat, double *lon) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A700_Send(const char *port, double lat, double lon) +int32 GPS_A700_Send(const char* port, double lat, double lon) { - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; @@ -6229,9 +6229,9 @@ int32 GPS_A700_Send(const char *port, double lat, double lon) ** ** @return [void] ************************************************************************/ -void GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon) +void GPS_D700_Get(GPS_PPacket packet, double* lat, double* lon) { - UC *p; + UC* p; double t; p = packet->data; @@ -6259,10 +6259,10 @@ void GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon) ** ** @return [void] ************************************************************************/ -void GPS_D700_Send(GPS_PPacket *packet, double lat, double lon) +void GPS_D700_Send(GPS_PPacket* packet, double lat, double lon) { UC data[16]; - UC *p; + UC* p; lat = GPS_Math_Deg_To_Rad(lat); lon = GPS_Math_Deg_To_Rad(lon); @@ -6290,7 +6290,7 @@ void GPS_D700_Send(GPS_PPacket *packet, double lat, double lon) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A800_On(const char *port, gpsdevh **fd) +int32 GPS_A800_On(const char* port, gpsdevh** fd) { static UC data[2]; GPS_PPacket tra; @@ -6334,7 +6334,7 @@ int32 GPS_A800_On(const char *port, gpsdevh **fd) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A800_Off(const char *port, gpsdevh **fd) +int32 GPS_A800_Off(const char* port, gpsdevh** fd) { static UC data[2]; GPS_PPacket tra; @@ -6377,7 +6377,7 @@ int32 GPS_A800_Off(const char *port, gpsdevh **fd) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet) +int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet) { GPS_PPacket tra; GPS_PPacket rec; @@ -6433,9 +6433,9 @@ int32 GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet) ** ** @return [void] ************************************************************************/ -void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt) +void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data* pvt) { - UC *p; + UC* p; p = packet->data; @@ -6493,10 +6493,10 @@ void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt) ** @return [int32] number of lap entries ************************************************************************/ -int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb) +int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; int32 i, n; @@ -6533,7 +6533,7 @@ int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb) n = GPS_Util_Get_Short(recpkt->data); if (n) - if (!((*lap)=(GPS_PLap *)malloc(n*sizeof(GPS_PLap)))) { + if (!((*lap)=(GPS_PLap*)malloc(n*sizeof(GPS_PLap)))) { GPS_Error("A906_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -6600,7 +6600,7 @@ int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb) ** ** @return [void] ************************************************************************/ -void GPS_D1011b_Get(GPS_PLap *Lap, UC *p) +void GPS_D1011b_Get(GPS_PLap* Lap, UC* p) { uint32 t; @@ -6711,13 +6711,13 @@ void GPS_D1011b_Get(GPS_PLap *Lap, UC *p) ************************************************************************/ int32 GPS_A1006_Get -(const char *port, - GPS_PCourse **crs, +(const char* port, + GPS_PCourse** crs, pcb_fn cb) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; int32 i, n; @@ -6755,7 +6755,7 @@ int32 GPS_A1006_Get if (n) - if (!((*crs)=(GPS_PCourse *)malloc(n*sizeof(GPS_PCourse)))) { + if (!((*crs)=(GPS_PCourse*)malloc(n*sizeof(GPS_PCourse)))) { GPS_Error("A1006_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -6829,10 +6829,10 @@ int32 GPS_A1006_Get ** ** @return [int32] success ************************************************************************/ -int32 GPS_A1006_Send(const char *port, - GPS_PCourse *crs, +int32 GPS_A1006_Send(const char* port, + GPS_PCourse* crs, int32 n_crs, - gpsdevh *fd) + gpsdevh* fd) { UC data[GPS_ARB_LEN]; GPS_PPacket tra; @@ -6906,7 +6906,7 @@ int32 GPS_A1006_Send(const char *port, ** ** @return [void] ************************************************************************/ -void GPS_D1006_Get(GPS_PCourse *crs, UC *p) +void GPS_D1006_Get(GPS_PCourse* crs, UC* p) { int i; (*crs)->index = GPS_Util_Get_Short(p); @@ -6930,9 +6930,9 @@ void GPS_D1006_Get(GPS_PCourse *crs, UC *p) ** ** @return [void] ************************************************************************/ -void GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len) +void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len) { - UC *p; + UC* p; int j; p = data; @@ -6965,10 +6965,10 @@ void GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len) ** @return [int32] number of lap entries ************************************************************************/ -int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb) +int32 GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; int32 i, n; @@ -7006,7 +7006,7 @@ int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb) if (n) - if (!((*clp)=(GPS_PCourse_Lap *)malloc(n*sizeof(GPS_PCourse_Lap)))) { + if (!((*clp)=(GPS_PCourse_Lap*)malloc(n*sizeof(GPS_PCourse_Lap)))) { GPS_Error("A1007_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -7080,10 +7080,10 @@ int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A1007_Send(const char *port, - GPS_PCourse_Lap *clp, +int32 GPS_A1007_Send(const char* port, + GPS_PCourse_Lap* clp, int32 n_clp, - gpsdevh *fd) + gpsdevh* fd) { UC data[GPS_ARB_LEN]; GPS_PPacket tra; @@ -7157,7 +7157,7 @@ int32 GPS_A1007_Send(const char *port, ** ** @return [void] ************************************************************************/ -void GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p) +void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p) { (*clp)->course_index = GPS_Util_Get_Short(p); p+=sizeof(uint16); @@ -7199,9 +7199,9 @@ void GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p) ** ** @return [void] ************************************************************************/ -void GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len) +void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32* len) { - UC *p; + UC* p; p = data; GPS_Util_Put_Short(p, (US) clp->course_index); @@ -7250,10 +7250,10 @@ void GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len) ** @return [int32] number of course point entries ************************************************************************/ -int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb) +int32 GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; int32 i, n; @@ -7291,7 +7291,7 @@ int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb) if (n) - if (!((*cpt)=(GPS_PCourse_Point *)malloc(n*sizeof(GPS_PCourse_Point)))) { + if (!((*cpt)=(GPS_PCourse_Point*)malloc(n*sizeof(GPS_PCourse_Point)))) { GPS_Error("A1008_Get: Insufficient memory"); return MEMORY_ERROR; } @@ -7366,10 +7366,10 @@ int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb) ** ** @return [int32] success ************************************************************************/ -int32 GPS_A1008_Send(const char *port, - GPS_PCourse_Point *cpt, +int32 GPS_A1008_Send(const char* port, + GPS_PCourse_Point* cpt, int32 n_cpt, - gpsdevh *fd) + gpsdevh* fd) { UC data[GPS_ARB_LEN]; GPS_PPacket tra; @@ -7443,7 +7443,7 @@ int32 GPS_A1008_Send(const char *port, ** ** @return [void] ************************************************************************/ -void GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p) +void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p) { int i; uint32 t; @@ -7475,9 +7475,9 @@ void GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p) ** ** @return [void] ************************************************************************/ -void GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len) +void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32* len) { - UC *p; + UC* p; int j; p = data; @@ -7515,10 +7515,10 @@ void GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len) ** @return [int32] success ************************************************************************/ -int32 GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits) +int32 GPS_A1009_Get(const char* port, GPS_PCourse_Limits limits) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket trapkt; GPS_PPacket recpkt; @@ -7580,7 +7580,7 @@ int32 GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits) ** ** @return [void] ************************************************************************/ -void GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p) +void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p) { limits->max_courses = GPS_Util_Get_Uint(p); p+=sizeof(uint32); @@ -7600,8 +7600,8 @@ void GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p) * It's unfortunate that these aren't constant and therefore switchable, * but they really are runtime variable. Sigh. */ -const char * -Get_Pkt_Type(US p, US d0, const char **xinfo) +const char* +Get_Pkt_Type(US p, US d0, const char** xinfo) { *xinfo = NULL; #define LT LINK_ID[gps_link_type] @@ -7834,7 +7834,7 @@ static UC Is_Trackpoint_Invalid(GPS_PTrack trk) ** @param [r] trk [GPS_PTrack **] track ** @param [r] n [int32 *] Number of trackpoints ************************************************************************/ -void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n) +void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n) { int32 i, j; diff --git a/gpsbabel/jeeps/gpsapp.h b/gpsbabel/jeeps/gpsapp.h index 9df0700ae..6f88fcc6b 100644 --- a/gpsbabel/jeeps/gpsapp.h +++ b/gpsbabel/jeeps/gpsapp.h @@ -9,80 +9,80 @@ extern "C" #include "gps.h" - int32 GPS_Init(const char *port); - - int32 GPS_A100_Get(const char *port, GPS_PWay **way, int (*cb)(int ct, GPS_PWay *)); - int32 GPS_A101_Get(const char *port); - int32 GPS_A100_Send(const char *port, GPS_PWay *way, int32 n, int (*cb)(GPS_PWay *)); - - int32 GPS_A200_Get(const char *port, GPS_PWay **way); - int32 GPS_A201_Get(const char *port, GPS_PWay **way); - int32 GPS_A200_Send(const char *port, GPS_PWay *way, int32 n); - int32 GPS_A201_Send(const char *port, GPS_PWay *way, int32 n); - - int32 GPS_A300_Get(const char *port, GPS_PTrack **trk, pcb_fn cb); - int32 GPS_A301_Get(const char *port, GPS_PTrack **trk, pcb_fn cb, int protoid); - int32 GPS_A300_Send(const char *port, GPS_PTrack *trk, int32 n); - int32 GPS_A301_Send(const char *port, GPS_PTrack *trk, int32 n, int protoid, - gpsdevh *fd); - - int32 GPS_D300_Get(GPS_PTrack *trk, int32 entries, gpsdevh *h); - void GPS_D300b_Get(GPS_PTrack *trk, UC *data); - void GPS_D301b_Get(GPS_PTrack *trk, UC *data); - void GPS_D302b_Get(GPS_PTrack *trk, UC *data); - void GPS_D303b_Get(GPS_PTrack *trk, UC *data); /*D304*/ - void GPS_D310_Get(GPS_PTrack *trk, UC *s); - void GPS_D311_Get(GPS_PTrack *trk, UC *s); - void GPS_D300_Send(UC *data, GPS_PTrack trk, int32 *len); - void GPS_D301_Send(UC *data, GPS_PTrack trk, int32 *len, int type); - void GPS_D303_Send(UC *data, GPS_PTrack trk, int32 *len, int protoid); - void GPS_D310_Send(UC *data, GPS_PTrack trk, int32 *len); - void GPS_D311_Send(UC *data, GPS_PTrack trk, int32 *len); - - int32 GPS_A400_Get(const char *port, GPS_PWay **way); - int32 GPS_A400_Send(const char *port, GPS_PWay *way, int32 n); - - int32 GPS_A500_Get(const char *port, GPS_PAlmanac **alm); - int32 GPS_A500_Send(const char *port, GPS_PAlmanac *alm, int32 n); - - time_t GPS_A600_Get(const char *port); + int32 GPS_Init(const char* port); + + int32 GPS_A100_Get(const char* port, GPS_PWay** way, int (*cb)(int ct, GPS_PWay*)); + int32 GPS_A101_Get(const char* port); + int32 GPS_A100_Send(const char* port, GPS_PWay* way, int32 n, int (*cb)(GPS_PWay*)); + + int32 GPS_A200_Get(const char* port, GPS_PWay** way); + int32 GPS_A201_Get(const char* port, GPS_PWay** way); + int32 GPS_A200_Send(const char* port, GPS_PWay* way, int32 n); + int32 GPS_A201_Send(const char* port, GPS_PWay* way, int32 n); + + int32 GPS_A300_Get(const char* port, GPS_PTrack** trk, pcb_fn cb); + int32 GPS_A301_Get(const char* port, GPS_PTrack** trk, pcb_fn cb, int protoid); + int32 GPS_A300_Send(const char* port, GPS_PTrack* trk, int32 n); + int32 GPS_A301_Send(const char* port, GPS_PTrack* trk, int32 n, int protoid, + gpsdevh* fd); + + int32 GPS_D300_Get(GPS_PTrack* trk, int32 entries, gpsdevh* h); + void GPS_D300b_Get(GPS_PTrack* trk, UC* data); + void GPS_D301b_Get(GPS_PTrack* trk, UC* data); + void GPS_D302b_Get(GPS_PTrack* trk, UC* data); + void GPS_D303b_Get(GPS_PTrack* trk, UC* data); /*D304*/ + void GPS_D310_Get(GPS_PTrack* trk, UC* s); + void GPS_D311_Get(GPS_PTrack* trk, UC* s); + void GPS_D300_Send(UC* data, GPS_PTrack trk, int32* len); + void GPS_D301_Send(UC* data, GPS_PTrack trk, int32* len, int type); + void GPS_D303_Send(UC* data, GPS_PTrack trk, int32* len, int protoid); + void GPS_D310_Send(UC* data, GPS_PTrack trk, int32* len); + void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len); + + int32 GPS_A400_Get(const char* port, GPS_PWay** way); + int32 GPS_A400_Send(const char* port, GPS_PWay* way, int32 n); + + int32 GPS_A500_Get(const char* port, GPS_PAlmanac** alm); + int32 GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32 n); + + time_t GPS_A600_Get(const char* port); time_t GPS_D600_Get(GPS_PPacket packet); - int32 GPS_A600_Send(const char *port, time_t Time); - void GPS_D600_Send(GPS_PPacket *packet, time_t Time); - - int32 GPS_A700_Get(const char *port, double *lat, double *lon); - int32 GPS_A700_Send(const char *port, double lat, double lon); - void GPS_D700_Get(GPS_PPacket packet, double *lat, double *lon); - void GPS_D700_Send(GPS_PPacket *packet, double lat, double lon); - - int32 GPS_A800_On(const char *port, gpsdevh **fd); - int32 GPS_A800_Off(const char *port, gpsdevh **fd); - int32 GPS_A800_Get(gpsdevh **fd, GPS_PPvt_Data *packet); - void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data *pvt); - - int32 GPS_A906_Get(const char *port, GPS_PLap **lap, pcb_fn cb); - void GPS_D1011b_Get(GPS_PLap *Lap,UC *data); /*D906 D1001 D1015*/ - - int32 GPS_A1006_Get(const char *port, GPS_PCourse **crs, pcb_fn cb); - int32 GPS_A1006_Send(const char *port, GPS_PCourse *crs, int32 n_crs, - gpsdevh *fd); - void GPS_D1006_Get(GPS_PCourse *crs, UC *p); - void GPS_D1006_Send(UC *data, GPS_PCourse crs, int32 *len); - - int32 GPS_A1007_Get(const char *port, GPS_PCourse_Lap **clp, pcb_fn cb); - int32 GPS_A1007_Send(const char *port, GPS_PCourse_Lap *clp, int32 n_clp, - gpsdevh *fd); - void GPS_D1007_Get(GPS_PCourse_Lap *clp, UC *p); - void GPS_D1007_Send(UC *data, GPS_PCourse_Lap clp, int32 *len); - - int32 GPS_A1008_Get(const char *port, GPS_PCourse_Point **cpt, pcb_fn cb); - int32 GPS_A1008_Send(const char *port, GPS_PCourse_Point *cpt, int32 n_cpt, - gpsdevh *fd); - void GPS_D1012_Get(GPS_PCourse_Point *cpt, UC *p); - void GPS_D1012_Send(UC *data, GPS_PCourse_Point cpt, int32 *len); - - int32 GPS_A1009_Get(const char *port, GPS_PCourse_Limits limits); - void GPS_D1013_Get(GPS_PCourse_Limits limits, UC *p); + int32 GPS_A600_Send(const char* port, time_t Time); + void GPS_D600_Send(GPS_PPacket* packet, time_t Time); + + int32 GPS_A700_Get(const char* port, double* lat, double* lon); + int32 GPS_A700_Send(const char* port, double lat, double lon); + void GPS_D700_Get(GPS_PPacket packet, double* lat, double* lon); + void GPS_D700_Send(GPS_PPacket* packet, double lat, double lon); + + int32 GPS_A800_On(const char* port, gpsdevh** fd); + int32 GPS_A800_Off(const char* port, gpsdevh** fd); + int32 GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet); + void GPS_D800_Get(GPS_PPacket packet, GPS_PPvt_Data* pvt); + + int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb); + void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/ + + int32 GPS_A1006_Get(const char* port, GPS_PCourse** crs, pcb_fn cb); + int32 GPS_A1006_Send(const char* port, GPS_PCourse* crs, int32 n_crs, + gpsdevh* fd); + void GPS_D1006_Get(GPS_PCourse* crs, UC* p); + void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32* len); + + int32 GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb); + int32 GPS_A1007_Send(const char* port, GPS_PCourse_Lap* clp, int32 n_clp, + gpsdevh* fd); + void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p); + void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32* len); + + int32 GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb); + int32 GPS_A1008_Send(const char* port, GPS_PCourse_Point* cpt, int32 n_cpt, + gpsdevh* fd); + void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p); + void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32* len); + + int32 GPS_A1009_Get(const char* port, GPS_PCourse_Limits limits); + void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p); /* Unhandled documented protocols, as of: Garmin Device Interface Specification, May 19, 2006, Drawing Number: 001-00063-00 Rev. C @@ -112,9 +112,9 @@ extern "C" Capability A1013: D1014 */ - const char * Get_Pkt_Type(US p, US d0, const char **xinfo); + const char* Get_Pkt_Type(US p, US d0, const char** xinfo); - void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n); + void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32* n); #endif diff --git a/gpsbabel/jeeps/gpscom.c b/gpsbabel/jeeps/gpscom.c index eba4af141..629be721e 100644 --- a/gpsbabel/jeeps/gpscom.c +++ b/gpsbabel/jeeps/gpscom.c @@ -36,10 +36,10 @@ ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Off(const char *port) +int32 GPS_Command_Off(const char* port) { static UC data[2]; - gpsdevh *fd; + gpsdevh* fd; GPS_PPacket tra; GPS_PPacket rec; @@ -90,7 +90,7 @@ int32 GPS_Command_Off(const char *port) ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_Command_Get_Waypoint(const char *port, GPS_PWay **way, pcb_fn cb) +int32 GPS_Command_Get_Waypoint(const char* port, GPS_PWay** way, pcb_fn cb) { int32 ret=0; @@ -132,7 +132,7 @@ int32 GPS_Command_Get_Waypoint(const char *port, GPS_PWay **way, pcb_fn cb) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Waypoint(const char *port, GPS_PWay *way, int32 n, int (*cb)(struct GPS_SWay **)) +int32 GPS_Command_Send_Waypoint(const char* port, GPS_PWay* way, int32 n, int (*cb)(struct GPS_SWay**)) { int32 ret=0; @@ -159,7 +159,7 @@ int32 GPS_Command_Send_Waypoint(const char *port, GPS_PWay *way, int32 n, int (* ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_Command_Get_Route(const char *port, GPS_PWay **way) +int32 GPS_Command_Get_Route(const char* port, GPS_PWay** way) { int32 ret=0; @@ -191,7 +191,7 @@ int32 GPS_Command_Get_Route(const char *port, GPS_PWay **way) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Route(const char *port, GPS_PWay *way, int32 n) +int32 GPS_Command_Send_Route(const char* port, GPS_PWay* way, int32 n) { int32 ret=0; @@ -222,7 +222,7 @@ int32 GPS_Command_Send_Route(const char *port, GPS_PWay *way, int32 n) ** @return [int32] number of track entries ************************************************************************/ -int32 GPS_Command_Get_Track(const char *port, GPS_PTrack **trk, pcb_fn cb) +int32 GPS_Command_Get_Track(const char* port, GPS_PTrack** trk, pcb_fn cb) { int32 ret=0; @@ -259,7 +259,7 @@ int32 GPS_Command_Get_Track(const char *port, GPS_PTrack **trk, pcb_fn cb) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n, int eraset) +int32 GPS_Command_Send_Track(const char* port, GPS_PTrack* trk, int32 n, int eraset) { int32 ret=0; @@ -299,7 +299,7 @@ int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n, int era ** @return [int32] number of waypoint entries ************************************************************************/ -int32 GPS_Command_Get_Proximity(const char *port, GPS_PWay **way) +int32 GPS_Command_Get_Proximity(const char* port, GPS_PWay** way) { int32 ret=0; @@ -332,7 +332,7 @@ int32 GPS_Command_Get_Proximity(const char *port, GPS_PWay **way) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Proximity(const char *port, GPS_PWay *way, int32 n) +int32 GPS_Command_Send_Proximity(const char* port, GPS_PWay* way, int32 n) { int32 ret=0; @@ -366,7 +366,7 @@ int32 GPS_Command_Send_Proximity(const char *port, GPS_PWay *way, int32 n) ** @return [int32] number of almanac entries ************************************************************************/ -int32 GPS_Command_Get_Almanac(const char *port, GPS_PAlmanac **alm) +int32 GPS_Command_Get_Almanac(const char* port, GPS_PAlmanac** alm) { int32 ret=0; @@ -399,7 +399,7 @@ int32 GPS_Command_Get_Almanac(const char *port, GPS_PAlmanac **alm) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Almanac(const char *port, GPS_PAlmanac *alm, int32 n) +int32 GPS_Command_Send_Almanac(const char* port, GPS_PAlmanac* alm, int32 n) { int32 ret=0; @@ -430,7 +430,7 @@ int32 GPS_Command_Send_Almanac(const char *port, GPS_PAlmanac *alm, int32 n) ** @return [time_t] unix-style time ************************************************************************/ -time_t GPS_Command_Get_Time(const char *port) +time_t GPS_Command_Get_Time(const char* port) { time_t ret=0; @@ -464,7 +464,7 @@ time_t GPS_Command_Get_Time(const char *port) ** @return [int32] true if OK ************************************************************************/ -int32 GPS_Command_Send_Time(const char *port, time_t Time) +int32 GPS_Command_Send_Time(const char* port, time_t Time) { time_t ret=0; @@ -494,7 +494,7 @@ int32 GPS_Command_Send_Time(const char *port, time_t Time) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Get_Position(const char *port, double *lat, double *lon) +int32 GPS_Command_Get_Position(const char* port, double* lat, double* lon) { int32 ret=0; @@ -530,7 +530,7 @@ int32 GPS_Command_Get_Position(const char *port, double *lat, double *lon) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Position(const char *port, double lat, double lon) +int32 GPS_Command_Send_Position(const char* port, double lat, double lon) { int32 ret=0; @@ -557,7 +557,7 @@ int32 GPS_Command_Send_Position(const char *port, double lat, double lon) ** @return [int32] success if supported and GPS starts sending ************************************************************************/ -int32 GPS_Command_Pvt_On(const char *port, gpsdevh **fd) +int32 GPS_Command_Pvt_On(const char* port, gpsdevh** fd) { int32 ret=0; @@ -592,7 +592,7 @@ int32 GPS_Command_Pvt_On(const char *port, gpsdevh **fd) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Pvt_Off(const char *port, gpsdevh **fd) +int32 GPS_Command_Pvt_Off(const char* port, gpsdevh** fd) { int32 ret=0; @@ -625,7 +625,7 @@ int32 GPS_Command_Pvt_Off(const char *port, gpsdevh **fd) ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Pvt_Get(gpsdevh **fd, GPS_PPvt_Data *pvt) +int32 GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt) { int32 ret=0; @@ -657,7 +657,7 @@ int32 GPS_Command_Pvt_Get(gpsdevh **fd, GPS_PPvt_Data *pvt) ** @return [int32] number of lap entries ************************************************************************/ -int32 GPS_Command_Get_Lap(const char *port, GPS_PLap **lap, pcb_fn cb) +int32 GPS_Command_Get_Lap(const char* port, GPS_PLap** lap, pcb_fn cb) { int32 ret=0; @@ -695,14 +695,14 @@ int32 GPS_Command_Get_Lap(const char *port, GPS_PLap **lap, pcb_fn cb) ** @return [int32] number of course entries ************************************************************************/ int32 GPS_Command_Get_Course -(const char *port, - GPS_PCourse **crs, - GPS_PCourse_Lap **clp, - GPS_PTrack **trk, - GPS_PCourse_Point **cpt, - int32 *n_clp, - int32 *n_trk, - int32 *n_cpt, +(const char* port, + GPS_PCourse** crs, + GPS_PCourse_Lap** clp, + GPS_PTrack** trk, + GPS_PCourse_Point** cpt, + int32* n_clp, + int32* n_trk, + int32* n_cpt, pcb_fn cb) { int32 ret=0; @@ -775,17 +775,17 @@ int32 GPS_Command_Get_Course ** @return [int32] Success ************************************************************************/ int32 GPS_Command_Send_Course -(const char *port, - GPS_PCourse *crs, - GPS_PCourse_Lap *clp, - GPS_PTrack *trk, - GPS_PCourse_Point *cpt, +(const char* port, + GPS_PCourse* crs, + GPS_PCourse_Lap* clp, + GPS_PTrack* trk, + GPS_PCourse_Point* cpt, int32 n_crs, int32 n_clp, int32 n_trk, int32 n_cpt) { - gpsdevh *fd; + gpsdevh* fd; GPS_OCourse_Limits limits; int32 ret; int32 ret_crs=0; @@ -891,7 +891,7 @@ int32 GPS_Command_Send_Course ** ** @return [uint32] course index ************************************************************************/ -static uint32 Unique_Course_Index(GPS_PCourse *crs, int n_crs) +static uint32 Unique_Course_Index(GPS_PCourse* crs, int n_crs) { uint32 idx; int i; @@ -918,7 +918,7 @@ static uint32 Unique_Course_Index(GPS_PCourse *crs, int n_crs) ** ** @return [uint32] track index ************************************************************************/ -static uint32 Unique_Track_Index(GPS_PCourse *crs, int n_crs) +static uint32 Unique_Track_Index(GPS_PCourse* crs, int n_crs) { uint32 idx; int i; @@ -951,7 +951,7 @@ static uint32 Unique_Track_Index(GPS_PCourse *crs, int n_crs) ** @return [void] ************************************************************************/ static void -Calculate_Course_Lap_Data(GPS_PCourse_Lap clp, GPS_PTrack *ctk, +Calculate_Course_Lap_Data(GPS_PCourse_Lap clp, GPS_PTrack* ctk, int ctk_start, int ctk_end) { int i; @@ -1040,10 +1040,10 @@ Calculate_Course_Lap_Data(GPS_PCourse_Lap clp, GPS_PTrack *ctk, ** @return [void] ************************************************************************/ static void -Course_Garbage_Collect(GPS_PCourse *crs, int *n_crs, - GPS_PCourse_Lap *clp, int *n_clp, - GPS_PTrack *ctk, int *n_ctk, - GPS_PCourse_Point *cpt, int *n_cpt) +Course_Garbage_Collect(GPS_PCourse* crs, int* n_crs, + GPS_PCourse_Lap* clp, int* n_clp, + GPS_PTrack* ctk, int* n_ctk, + GPS_PCourse_Point* cpt, int* n_cpt) { int i, j; @@ -1155,13 +1155,13 @@ restart_course_points: ** @return [int32] success ************************************************************************/ -int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32 n_trk, - GPS_PWay *wpt, int32 n_wpt, int eraset) +int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 n_trk, + GPS_PWay* wpt, int32 n_wpt, int eraset) { - GPS_PCourse *crs = NULL; - GPS_PCourse_Lap *clp = NULL; - GPS_PTrack *ctk = NULL; - GPS_PCourse_Point *cpt = NULL; + GPS_PCourse* crs = NULL; + GPS_PCourse_Lap* clp = NULL; + GPS_PTrack* ctk = NULL; + GPS_PCourse_Point* cpt = NULL; int n_crs, n_clp=0, n_ctk=0, n_cpt=0; int i, j, trk_end, new_crs, first_new_ctk; int32 ret; @@ -1310,22 +1310,22 @@ int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32 } /*Stubs for unimplemented stuff*/ -int32 GPS_Command_Get_Workout(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)) +int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)) { return 0; } -int32 GPS_Command_Get_Fitness_User_Profile(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)) +int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)) { return 0; } -int32 GPS_Command_Get_Workout_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)) +int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)) { return 0; } -int32 GPS_Command_Get_Course_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)) +int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)) { return 0; } diff --git a/gpsbabel/jeeps/gpscom.h b/gpsbabel/jeeps/gpscom.h index 12c7def60..8520312d6 100644 --- a/gpsbabel/jeeps/gpscom.h +++ b/gpsbabel/jeeps/gpscom.h @@ -10,45 +10,45 @@ extern "C" #include "gps.h" #include - int32 GPS_Command_Off(const char *port); + int32 GPS_Command_Off(const char* port); - time_t GPS_Command_Get_Time(const char *port); - int32 GPS_Command_Send_Time(const char *port, time_t Time); + time_t GPS_Command_Get_Time(const char* port); + int32 GPS_Command_Send_Time(const char* port, time_t Time); - int32 GPS_Command_Get_Position(const char *port, double *lat, double *lon); - int32 GPS_Command_Send_Position(const char *port, double lat, double lon); + int32 GPS_Command_Get_Position(const char* port, double* lat, double* lon); + int32 GPS_Command_Send_Position(const char* port, double lat, double lon); - int32 GPS_Command_Pvt_On(const char *port, gpsdevh **fd); - int32 GPS_Command_Pvt_Off(const char *port, gpsdevh **fd); - int32 GPS_Command_Pvt_Get(gpsdevh **fd, GPS_PPvt_Data *pvt); + int32 GPS_Command_Pvt_On(const char* port, gpsdevh** fd); + int32 GPS_Command_Pvt_Off(const char* port, gpsdevh** fd); + int32 GPS_Command_Pvt_Get(gpsdevh** fd, GPS_PPvt_Data* pvt); - int32 GPS_Command_Get_Almanac(const char *port, GPS_PAlmanac **alm); - int32 GPS_Command_Send_Almanac(const char *port, GPS_PAlmanac *alm, int32 n); + int32 GPS_Command_Get_Almanac(const char* port, GPS_PAlmanac** alm); + int32 GPS_Command_Send_Almanac(const char* port, GPS_PAlmanac* alm, int32 n); - int32 GPS_Command_Get_Track(const char *port, GPS_PTrack **trk, int (*cb)(int, struct GPS_SWay **)); - int32 GPS_Command_Send_Track(const char *port, GPS_PTrack *trk, int32 n, int eraset); + int32 GPS_Command_Get_Track(const char* port, GPS_PTrack** trk, int (*cb)(int, struct GPS_SWay**)); + int32 GPS_Command_Send_Track(const char* port, GPS_PTrack* trk, int32 n, int eraset); - int32 GPS_Command_Get_Waypoint(const char *port, GPS_PWay **way,int (*cb)(int, struct GPS_SWay **)); - int32 GPS_Command_Send_Waypoint(const char *port, GPS_PWay *way, int32 n, int (*cb)(struct GPS_SWay **)); + int32 GPS_Command_Get_Waypoint(const char* port, GPS_PWay** way,int (*cb)(int, struct GPS_SWay**)); + int32 GPS_Command_Send_Waypoint(const char* port, GPS_PWay* way, int32 n, int (*cb)(struct GPS_SWay**)); - int32 GPS_Command_Get_Proximity(const char *port, GPS_PWay **way); - int32 GPS_Command_Send_Proximity(const char *port, GPS_PWay *way, int32 n); + int32 GPS_Command_Get_Proximity(const char* port, GPS_PWay** way); + int32 GPS_Command_Send_Proximity(const char* port, GPS_PWay* way, int32 n); - int32 GPS_Command_Get_Route(const char *port, GPS_PWay **way); - int32 GPS_Command_Send_Route(const char *port, GPS_PWay *way, int32 n); + int32 GPS_Command_Get_Route(const char* port, GPS_PWay** way); + int32 GPS_Command_Send_Route(const char* port, GPS_PWay* way, int32 n); - int32 GPS_Command_Get_Lap(const char *port, GPS_PLap **lap, int (*cb)(int, struct GPS_SWay **)); + int32 GPS_Command_Get_Lap(const char* port, GPS_PLap** lap, int (*cb)(int, struct GPS_SWay**)); - int32 GPS_Command_Send_Course(const char *port, GPS_PCourse *crs, GPS_PCourse_Lap *clp, - GPS_PTrack *trk, GPS_PCourse_Point *cpt, + int32 GPS_Command_Send_Course(const char* port, GPS_PCourse* crs, GPS_PCourse_Lap* clp, + GPS_PTrack* trk, GPS_PCourse_Point* cpt, int32 n_crs, int32 n_clp, int32 n_trk, int32 n_cpt); - int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32 n_trk, - GPS_PWay *wpt, int32 n_wpt, int eraset); + int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 n_trk, + GPS_PWay* wpt, int32 n_wpt, int eraset); - int32 GPS_Command_Get_Workout(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)); - int32 GPS_Command_Get_Fitness_User_Profile(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)); - int32 GPS_Command_Get_Workout_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)); - int32 GPS_Command_Get_Course_Limits(const char *port, void **lap, int (*cb)(int, struct GPS_SWay **)); + int32 GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)); + int32 GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)); + int32 GPS_Command_Get_Workout_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)); + int32 GPS_Command_Get_Course_Limits(const char* port, void** lap, int (*cb)(int, struct GPS_SWay**)); #endif #ifdef __cplusplus diff --git a/gpsbabel/jeeps/gpsdatum.h b/gpsbabel/jeeps/gpsdatum.h index 34a54f15e..faa54fe86 100644 --- a/gpsbabel/jeeps/gpsdatum.h +++ b/gpsbabel/jeeps/gpsdatum.h @@ -9,7 +9,7 @@ extern "C" typedef struct GPS_SEllipse { - char *name; + char* name; double a; double invf; } GPS_OEllipse, *GPS_PEllipse; @@ -48,7 +48,7 @@ extern "C" typedef struct GPS_SDatum { - char *name; + char* name; int ellipse; double dx; double dy; @@ -187,7 +187,7 @@ extern "C" typedef struct GPS_SDatum_Alias { - char *alias; + char* alias; const int datum; } GPS_ODatum_Alias, *GPS_PDatum_Alias; @@ -227,7 +227,7 @@ extern "C" /* UK Ordnance Survey Nation Grid Map Codes */ - static char *UKNG[]= { + static char* UKNG[]= { "SV","SW","SX","SY","SZ","TV","TW","SQ","SR","SS","ST","SU","TQ","TR", "SL","SM","SN","SO","SP","TL","TM","SF","SG","SH","SJ","SK","TF","TG", "SA","SB","SC","SD","SE","TA","TB","NV","NW","NX","NY","NZ","OV","OW", diff --git a/gpsbabel/jeeps/gpsdevice.c b/gpsbabel/jeeps/gpsdevice.c index 669735c5b..eef48edd7 100644 --- a/gpsbabel/jeeps/gpsdevice.c +++ b/gpsbabel/jeeps/gpsdevice.c @@ -25,9 +25,9 @@ extern gps_device_ops gps_serial_ops; extern gps_device_ops gps_usb_ops; -gps_device_ops *ops = NULL; +gps_device_ops* ops = NULL; -int32 GPS_Device_On(const char *port, gpsdevh **fd) +int32 GPS_Device_On(const char* port, gpsdevh** fd) { gps_is_usb = (0 == case_ignore_strncmp(port, "usb:", 4)); @@ -40,47 +40,47 @@ int32 GPS_Device_On(const char *port, gpsdevh **fd) return (ops->Device_On)(port, fd); } -int32 GPS_Device_Off(gpsdevh * fd) +int32 GPS_Device_Off(gpsdevh* fd) { return (ops->Device_Off)(fd); } -int32 GPS_Device_Wait(gpsdevh * fd) +int32 GPS_Device_Wait(gpsdevh* fd) { return (ops->Device_Wait)(fd); } -int32 GPS_Device_Chars_Ready(gpsdevh * fd) +int32 GPS_Device_Chars_Ready(gpsdevh* fd) { return (ops->Device_Chars_Ready)(fd); } -int32 GPS_Device_Flush(gpsdevh * fd) +int32 GPS_Device_Flush(gpsdevh* fd) { return (ops->Device_Flush)(fd); } -int32 GPS_Write_Packet(gpsdevh * fd, GPS_PPacket packet) +int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket packet) { return (ops->Write_Packet)(fd, packet); } -int32 GPS_Packet_Read(gpsdevh * fd, GPS_PPacket *packet) +int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) { return (ops->Read_Packet)(fd, packet); } -int32 GPS_Send_Ack(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec) +int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec) { return (ops->Send_Ack)(fd, tra, rec); } -int32 GPS_Get_Ack(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec) +int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec) { return (ops->Get_Ack)(fd, tra, rec); } -void GPS_Make_Packet(GPS_PPacket *packet, US type, UC *data, uint32 n) +void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n) { (*packet)->type = type; memcpy((*packet)->data, data, n); diff --git a/gpsbabel/jeeps/gpsdevice.h b/gpsbabel/jeeps/gpsdevice.h index f32192ccc..481826545 100644 --- a/gpsbabel/jeeps/gpsdevice.h +++ b/gpsbabel/jeeps/gpsdevice.h @@ -34,24 +34,24 @@ extern "C" #define usecDELAY 180000 /* Microseconds before GPS sends A001 */ - int32 GPS_Device_Chars_Ready(gpsdevh *fd); - int32 GPS_Device_On(const char *port, gpsdevh **fd); - int32 GPS_Device_Off(gpsdevh *fd); - int32 GPS_Device_Wait(gpsdevh * fd); - int32 GPS_Device_Flush(gpsdevh * fd); - int32 GPS_Device_Read(int32 ignored, void *ibuf, int size); - int32 GPS_Device_Write(int32 ignored, const void *obuf, int size); - void GPS_Device_Error(char *hdr, ...); - int32 GPS_Write_Packet(gpsdevh *fd, GPS_PPacket packet); - int32 GPS_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec); - int32 GPS_Packet_Read(gpsdevh *fd, GPS_PPacket *packet); - int32 GPS_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec); + int32 GPS_Device_Chars_Ready(gpsdevh* fd); + int32 GPS_Device_On(const char* port, gpsdevh** fd); + int32 GPS_Device_Off(gpsdevh* fd); + int32 GPS_Device_Wait(gpsdevh* fd); + int32 GPS_Device_Flush(gpsdevh* fd); + int32 GPS_Device_Read(int32 ignored, void* ibuf, int size); + int32 GPS_Device_Write(int32 ignored, const void* obuf, int size); + void GPS_Device_Error(char* hdr, ...); + int32 GPS_Write_Packet(gpsdevh* fd, GPS_PPacket packet); + int32 GPS_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); + int32 GPS_Packet_Read(gpsdevh* fd, GPS_PPacket* packet); + int32 GPS_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); - typedef int32(*gps_device_op)(gpsdevh *); - typedef int32(*gps_device_op5)(const char *, gpsdevh **fd); - typedef int32(*gps_device_op10)(gpsdevh * fd, GPS_PPacket *tra, GPS_PPacket *rec); - typedef int32(*gps_device_op12)(gpsdevh * fd, GPS_PPacket packet); - typedef int32(*gps_device_op13)(gpsdevh * fd, GPS_PPacket *packet); + typedef int32(*gps_device_op)(gpsdevh*); + typedef int32(*gps_device_op5)(const char*, gpsdevh** fd); + typedef int32(*gps_device_op10)(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); + typedef int32(*gps_device_op12)(gpsdevh* fd, GPS_PPacket packet); + typedef int32(*gps_device_op13)(gpsdevh* fd, GPS_PPacket* packet); typedef struct { gps_device_op5 Device_On; gps_device_op Device_Off; diff --git a/gpsbabel/jeeps/gpsdevice_usb.c b/gpsbabel/jeeps/gpsdevice_usb.c index 11c6703af..a9a9c9f8b 100644 --- a/gpsbabel/jeeps/gpsdevice_usb.c +++ b/gpsbabel/jeeps/gpsdevice_usb.c @@ -31,17 +31,17 @@ static int32 success_stub(void) return 1; } -static int32 gdu_on(const char *port, gpsdevh **fd) +static int32 gdu_on(const char* port, gpsdevh** fd) { return gusb_init(port, fd); } -static int32 gdu_off(gpsdevh *dh) +static int32 gdu_off(gpsdevh* dh) { return gusb_close(dh); } -static int32 gdu_read(gpsdevh *fd, GPS_PPacket *packet) +static int32 gdu_read(gpsdevh* fd, GPS_PPacket* packet) { /* Default is to eat bulk request packets. */ return GPS_Packet_Read_usb(fd, packet, 1); diff --git a/gpsbabel/jeeps/gpsfmt.c b/gpsbabel/jeeps/gpsfmt.c index 6d383d0a2..af355a273 100644 --- a/gpsbabel/jeeps/gpsfmt.c +++ b/gpsbabel/jeeps/gpsfmt.c @@ -26,30 +26,30 @@ #include -static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE *outf); -static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE *outf); - -static void GPS_Fmt_Print_Track301(GPS_PTrack *trk, int32 n, FILE *outf); -static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE *outf); -static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE *outf); - -static int32 GPS_Fmt_Print_Route201(GPS_PWay *way, int32 n, FILE *outf); - - -char *gps_marine_sym[]= { +static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE* outf); +static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE* outf); + +static void GPS_Fmt_Print_Track301(GPS_PTrack* trk, int32 n, FILE* outf); +static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE* outf); +static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE* outf); + +static int32 GPS_Fmt_Print_Route201(GPS_PWay* way, int32 n, FILE* outf); + + +char* gps_marine_sym[]= { "Anchor","Bell","Diamond-grn","Diamond_red","Dive1","Dive2","Dollar", "Fish","Fuel","Horn","House","Knife","Light","Mug","Skull", "Square_grn","Square_red","Wbuoy","Wpt_dot","Wreck","Null","Mob", @@ -80,7 +80,7 @@ char *gps_marine_sym[]= { -char *gps_land_sym[]= { +char* gps_land_sym[]= { "Is_hwy","Us_hwy","St_hwy","Mi_mrkr","Trcbck","Golf","Sml_cty", "Med_cty","Lrg_cty","Freeway","Ntl_hwy","Cap_cty","Amuse_pk", "Bowling","Car_rental","Car_repair","Fastfood","Fitness","Film", @@ -95,14 +95,14 @@ char *gps_land_sym[]= { }; -char *gps_aviation_sym[]= { +char* gps_aviation_sym[]= { "Airport","Int","Ndb","Vor","Heliport","Private","Soft_fld", "Tall_tower","Short_tower","Glider","Ultralight","Parachute", "Vortac","Vordme","Faf","Lom","Map","Tacan","Seaplane" }; -char *gps_16_sym[]= { +char* gps_16_sym[]= { "Dot","House","Fuel","Car","Fish","Boat","Anchor","Wreck", "Exit","Skull","Flag","Camp","Circle-x","Deer","1st_aid","Back_track" }; @@ -121,7 +121,7 @@ char *gps_16_sym[]= { ** @return [void] ************************************************************************/ -void GPS_Fmt_Print_Time(time_t Time, FILE *outf) +void GPS_Fmt_Print_Time(time_t Time, FILE* outf) { (void) fprintf(outf,"%s",ctime(&Time)); fflush(outf); @@ -142,7 +142,7 @@ void GPS_Fmt_Print_Time(time_t Time, FILE *outf) ** @return [void] ************************************************************************/ -void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf) +void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf) { (void) fprintf(outf,"Latitude: %f Longitude %f\n",lat,lon); fflush(outf); @@ -162,7 +162,7 @@ void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf) ** @return [void] ************************************************************************/ -void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE *outf) +void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf) { (void) fprintf(outf,"Fix: "); @@ -222,7 +222,7 @@ void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE *outf) ** @return [void] ************************************************************************/ -void GPS_Fmt_Print_Almanac(GPS_PAlmanac *alm, int32 n, FILE *outf) +void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf) { int32 i; int32 t; @@ -294,7 +294,7 @@ void GPS_Fmt_Print_Almanac(GPS_PAlmanac *alm, int32 n, FILE *outf) ** @return [void] ************************************************************************/ -void GPS_Fmt_Print_Track(GPS_PTrack *trk, int32 n, FILE *outf) +void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf) { int32 i; @@ -350,7 +350,7 @@ void GPS_Fmt_Print_Track(GPS_PTrack *trk, int32 n, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Track301(GPS_PTrack *trk, int32 n, FILE *outf) +static void GPS_Fmt_Print_Track301(GPS_PTrack* trk, int32 n, FILE* outf) { int32 i; @@ -404,7 +404,7 @@ static void GPS_Fmt_Print_Track301(GPS_PTrack *trk, int32 n, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE *outf) +static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE* outf) { (void) fprintf(outf,"\tLatitude: %f\n",trk->lat); (void) fprintf(outf,"\tLongitude: %f\n",trk->lon); @@ -429,7 +429,7 @@ static void GPS_Fmt_Print_D300(GPS_PTrack trk, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE *outf) +static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE* outf) { (void) fprintf(outf,"\tLatitude: %f\n",trk->lat); (void) fprintf(outf,"\tLongitude: %f\n",trk->lon); @@ -458,7 +458,7 @@ static void GPS_Fmt_Print_D301(GPS_PTrack trk, FILE *outf) ** @return [int32] success ************************************************************************/ -int32 GPS_Fmt_Print_Waypoint(GPS_PWay *way, int32 n, FILE *outf) +int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf) { int32 i; @@ -542,7 +542,7 @@ int32 GPS_Fmt_Print_Waypoint(GPS_PWay *way, int32 n, FILE *outf) ** @return [int32] success ************************************************************************/ -int32 GPS_Fmt_Print_Proximity(GPS_PWay *way, int32 n, FILE *outf) +int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf) { int32 i; @@ -628,7 +628,7 @@ int32 GPS_Fmt_Print_Proximity(GPS_PWay *way, int32 n, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE* outf) { (void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident); @@ -650,7 +650,7 @@ static void GPS_Fmt_Print_Way100(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE* outf) { if (way->smbl > 176) { @@ -678,9 +678,9 @@ static void GPS_Fmt_Print_Way101(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -716,9 +716,9 @@ static void GPS_Fmt_Print_Way102(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE* outf) { - static char *dspl[]= { + static char* dspl[]= { "SW","S","SC" }; @@ -745,12 +745,12 @@ static void GPS_Fmt_Print_Way103(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE* outf) { - static char *dspl[]= { + static char* dspl[]= { "S","S","","SW","","SC" }; - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -787,9 +787,9 @@ static void GPS_Fmt_Print_Way104(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -823,9 +823,9 @@ static void GPS_Fmt_Print_Way105(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -872,12 +872,12 @@ static void GPS_Fmt_Print_Way106(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE* outf) { - static char *dspl[]= { + static char* dspl[]= { "SW","S","SC" }; - static char *col[]= { + static char* col[]= { "Default","Red","Green","Blue" }; @@ -908,16 +908,16 @@ static void GPS_Fmt_Print_Way107(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; - static char *dspl[]= { + static char* dspl[]= { "SW","S","SC" }; - static char *col[]= { + static char* col[]= { "Black","Dark_Red","Dark_Green","Dark_Yellow","Dark_Blue", "Dark_Magenta","Dark_Cyan","Light_Grey","Dark_Grey","Red","Green", "Yellow","Blue","Magenta","Cyan","White" @@ -983,16 +983,16 @@ static void GPS_Fmt_Print_Way108(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; - static char *dspl[]= { + static char* dspl[]= { "SW","S","SC" }; - static char *col[]= { + static char* col[]= { "Black","Dark_Red","Dark_Green","Dark_Yellow","Dark_Blue", "Dark_Magenta","Dark_Cyan","Light_Grey","Dark_Grey","Red","Green", "Yellow","Blue","Magenta","Cyan","White" @@ -1061,7 +1061,7 @@ static void GPS_Fmt_Print_Way109(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE* outf) { (void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident); @@ -1093,7 +1093,7 @@ static void GPS_Fmt_Print_Way150(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE* outf) { (void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident); @@ -1126,7 +1126,7 @@ static void GPS_Fmt_Print_Way151(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE* outf) { (void) fprintf(outf,"\tIdent: %-6.6s\n",way->ident); @@ -1158,9 +1158,9 @@ static void GPS_Fmt_Print_Way152(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE* outf) { - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -1206,13 +1206,13 @@ static void GPS_Fmt_Print_Way154(GPS_PWay way, FILE *outf) ** @return [void] ************************************************************************/ -static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE *outf) +static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE* outf) { - static char *dspl[]= { + static char* dspl[]= { "","S","","SW","","SC" }; - char **p; + char** p; int32 x; if (way->smbl < 8192) { @@ -1262,7 +1262,7 @@ static void GPS_Fmt_Print_Way155(GPS_PWay way, FILE *outf) ** @return [int32] success ************************************************************************/ -int32 GPS_Fmt_Print_Route(GPS_PWay *way, int32 n, FILE *outf) +int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf) { int32 i; int32 first; @@ -1389,7 +1389,7 @@ int32 GPS_Fmt_Print_Route(GPS_PWay *way, int32 n, FILE *outf) ** @return [int32] success ************************************************************************/ -static int32 GPS_Fmt_Print_Route201(GPS_PWay *way, int32 n, FILE *outf) +static int32 GPS_Fmt_Print_Route201(GPS_PWay* way, int32 n, FILE* outf) { int32 i; int32 first; diff --git a/gpsbabel/jeeps/gpsfmt.h b/gpsbabel/jeeps/gpsfmt.h index 3db8e02a5..8a7377b37 100644 --- a/gpsbabel/jeeps/gpsfmt.h +++ b/gpsbabel/jeeps/gpsfmt.h @@ -11,14 +11,14 @@ extern "C" #include #include - void GPS_Fmt_Print_Time(time_t Time, FILE *outf); - void GPS_Fmt_Print_Position(double lat, double lon, FILE *outf); - void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE *outf); - void GPS_Fmt_Print_Almanac(GPS_PAlmanac *alm, int32 n, FILE *outf); - void GPS_Fmt_Print_Track(GPS_PTrack *trk, int32 n, FILE *outf); - int32 GPS_Fmt_Print_Waypoint(GPS_PWay *way, int32 n, FILE *outf); - int32 GPS_Fmt_Print_Proximity(GPS_PWay *way, int32 n, FILE *outf); - int32 GPS_Fmt_Print_Route(GPS_PWay *way, int32 n, FILE *outf); + void GPS_Fmt_Print_Time(time_t Time, FILE* outf); + void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf); + void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf); + void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32 n, FILE* outf); + void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32 n, FILE* outf); + int32 GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32 n, FILE* outf); + int32 GPS_Fmt_Print_Proximity(GPS_PWay* way, int32 n, FILE* outf); + int32 GPS_Fmt_Print_Route(GPS_PWay* way, int32 n, FILE* outf); #endif diff --git a/gpsbabel/jeeps/gpsinput.c b/gpsbabel/jeeps/gpsinput.c index eea2d8c2c..66e708b70 100644 --- a/gpsbabel/jeeps/gpsinput.c +++ b/gpsbabel/jeeps/gpsinput.c @@ -28,32 +28,32 @@ #include -static int32 GPS_Input_Load_String(char *t, int32 n, char *s); -static int32 GPS_Input_Load_Strnull(char *t, char *s); -static int32 GPS_Input_Read_Line(char *s, FILE *inf); - -static int32 GPS_Input_Get_D100(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D101(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D102(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D104(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum); -static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D152(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf); -static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf); - -static int32 GPS_Input_Get_Track301(GPS_PTrack **trk, FILE *inf, int32 type, +static int32 GPS_Input_Load_String(char* t, int32 n, char* s); +static int32 GPS_Input_Load_Strnull(char* t, char* s); +static int32 GPS_Input_Read_Line(char* s, FILE* inf); + +static int32 GPS_Input_Get_D100(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D101(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D102(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D103(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D104(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D105(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D106(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D107(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D108(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D109(GPS_PWay* way, FILE* inf, int protonum); +static int32 GPS_Input_Get_D150(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D151(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D152(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D154(GPS_PWay* way, FILE* inf); +static int32 GPS_Input_Get_D155(GPS_PWay* way, FILE* inf); + +static int32 GPS_Input_Get_Track301(GPS_PTrack** trk, FILE* inf, int32 type, int32 n); -static int32 GPS_Input_Get_D300(GPS_PTrack *trk, FILE *inf, char *s); -static int32 GPS_Input_Get_D301(GPS_PTrack *trk, FILE *inf, char *s); +static int32 GPS_Input_Get_D300(GPS_PTrack* trk, FILE* inf, char* s); +static int32 GPS_Input_Get_D301(GPS_PTrack* trk, FILE* inf, char* s); -static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf); +static int32 GPS_Input_Get_Route201(GPS_PWay** way, FILE* inf); /* @funcstatic GPS_Input_Load_String *********************************** @@ -67,10 +67,10 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf); ** ** @return [int32] success ************************************************************************/ -static int32 GPS_Input_Load_String(char *t, int32 n, char *s) +static int32 GPS_Input_Load_String(char* t, int32 n, char* s) { - char *p; - char *q; + char* p; + char* q; int32 len; int32 i; @@ -119,10 +119,10 @@ static int32 GPS_Input_Load_String(char *t, int32 n, char *s) ** ** @return [int32] success ************************************************************************/ -static int32 GPS_Input_Load_Strnull(char *t, char *s) +static int32 GPS_Input_Load_Strnull(char* t, char* s) { - char *p; - char *q; + char* p; + char* q; gps_errno = INPUT_ERROR; @@ -154,7 +154,7 @@ static int32 GPS_Input_Load_Strnull(char *t, char *s) ** @return [int32] success ************************************************************************/ -static int32 GPS_Input_Read_Line(char *s, FILE *inf) +static int32 GPS_Input_Read_Line(char* s, FILE* inf) { int32 len; @@ -185,7 +185,7 @@ static int32 GPS_Input_Read_Line(char *s, FILE *inf) ** @return [int32] number of entries ************************************************************************/ -int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) +int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf) { char s[GPS_ARB_LEN]; int32 n; @@ -193,7 +193,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) int32 i; int32 d; float f; - char *p; + char* p; gps_errno = INPUT_ERROR; @@ -202,12 +202,12 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) return gps_errno; } - if (sscanf(s,"Almanac %d%d",(int *)&n,(int *)&type)!=2) { + if (sscanf(s,"Almanac %d%d",(int*)&n,(int*)&type)!=2) { return gps_errno; } if (!type) { - if (!(*alm = (GPS_PAlmanac *) malloc(32*sizeof(GPS_PAlmanac *)))) { + if (!(*alm = (GPS_PAlmanac*) malloc(32*sizeof(GPS_PAlmanac*)))) { return MEMORY_ERROR; } for (i=0; i<32; ++i) { @@ -219,7 +219,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) (*alm)[i]->wn = -1; } } else { - if (!(*alm = (GPS_PAlmanac *) malloc(n*sizeof(GPS_PAlmanac *)))) { + if (!(*alm = (GPS_PAlmanac*) malloc(n*sizeof(GPS_PAlmanac*)))) { return MEMORY_ERROR; } for (i=0; i<32; ++i) @@ -238,7 +238,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } --d; @@ -253,7 +253,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*alm)[i]->wn = d; @@ -352,7 +352,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*alm)[i]->hlth=d; @@ -377,7 +377,7 @@ int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf) ** @return [int32] number of entries ************************************************************************/ -int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf) +int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf) { char s[GPS_ARB_LEN]; int32 n; @@ -391,7 +391,7 @@ int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) { + if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) { return gps_errno; } @@ -414,7 +414,7 @@ int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf) } fseek(inf,pos,0); - if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) { + if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) { return MEMORY_ERROR; } for (i=0; ismbl = d; @@ -829,7 +829,7 @@ static int32 GPS_Input_Get_D101(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D102(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D102(GPS_PWay* way, FILE* inf) { return GPS_Input_Get_D101(way,inf); } @@ -845,10 +845,10 @@ static int32 GPS_Input_Get_D102(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D103(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -886,7 +886,7 @@ static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -895,7 +895,7 @@ static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->dspl = d; @@ -914,7 +914,7 @@ static int32 GPS_Input_Get_D103(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D104(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D104(GPS_PWay* way, FILE* inf) { return GPS_Input_Get_D103(way,inf); } @@ -930,10 +930,10 @@ static int32 GPS_Input_Get_D104(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D105(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -961,7 +961,7 @@ static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -985,10 +985,10 @@ static int32 GPS_Input_Get_D105(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D106(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -997,7 +997,7 @@ static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = d; @@ -1005,7 +1005,7 @@ static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - GPS_Input_Load_String((char *)(*way)->subclass,13,s); + GPS_Input_Load_String((char*)(*way)->subclass,13,s); if (!GPS_Input_Read_Line(s,inf)) { @@ -1035,7 +1035,7 @@ static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -1064,10 +1064,10 @@ static int32 GPS_Input_Get_D106(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D107(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; int32 d; int32 ret; @@ -1080,7 +1080,7 @@ static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->colour = d; @@ -1099,10 +1099,10 @@ static int32 GPS_Input_Get_D107(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D108(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; int32 xc; @@ -1135,7 +1135,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->colour = d; @@ -1144,7 +1144,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->dspl = d; @@ -1153,7 +1153,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -1162,7 +1162,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1190,7 +1190,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = d; @@ -1200,7 +1200,7 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - GPS_Input_Load_String((char *)(*way)->subclass,18,s); + GPS_Input_Load_String((char*)(*way)->subclass,18,s); } else { GPS_Util_Put_Short((*way)->subclass,0); GPS_Util_Put_Int((*way)->subclass+2,0); @@ -1256,10 +1256,10 @@ static int32 GPS_Input_Get_D108(GPS_PWay *way, FILE *inf) ** @return [int32] number of entries ** D109's and D110's are so similar, we handle both with the same function. ************************************************************************/ -static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) +static int32 GPS_Input_Get_D109(GPS_PWay* way, FILE* inf, int protonum) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; int32 xc; @@ -1292,7 +1292,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->colour = d; @@ -1301,7 +1301,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->dspl = d; @@ -1310,7 +1310,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -1319,7 +1319,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1347,7 +1347,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = d; @@ -1357,7 +1357,7 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - GPS_Input_Load_String((char *)(*way)->subclass,18,s); + GPS_Input_Load_String((char*)(*way)->subclass,18,s); } else { GPS_Util_Put_Short((*way)->subclass,0); GPS_Util_Put_Int((*way)->subclass+2,0); @@ -1411,10 +1411,10 @@ static int32 GPS_Input_Get_D109(GPS_PWay *way, FILE *inf, int protonum) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D150(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -1453,7 +1453,7 @@ static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = cl = d; @@ -1485,7 +1485,7 @@ static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1505,10 +1505,10 @@ static int32 GPS_Input_Get_D150(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D151(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -1547,7 +1547,7 @@ static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = cl = d; @@ -1579,7 +1579,7 @@ static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1598,7 +1598,7 @@ static int32 GPS_Input_Get_D151(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D152(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D152(GPS_PWay* way, FILE* inf) { return GPS_Input_Get_D150(way,inf); } @@ -1614,10 +1614,10 @@ static int32 GPS_Input_Get_D152(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D154(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -1656,7 +1656,7 @@ static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -1665,7 +1665,7 @@ static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = cl = d; @@ -1697,7 +1697,7 @@ static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1717,10 +1717,10 @@ static int32 GPS_Input_Get_D154(GPS_PWay *way, FILE *inf) ** ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) +static int32 GPS_Input_Get_D155(GPS_PWay* way, FILE* inf) { char s[GPS_ARB_LEN]; - char *p; + char* p; double f; int32 d; @@ -1759,7 +1759,7 @@ static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->smbl = d; @@ -1768,7 +1768,7 @@ static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->dspl = d; @@ -1777,7 +1777,7 @@ static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->wpt_class = cl = d; @@ -1809,7 +1809,7 @@ static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_errno; } (*way)->alt = d; @@ -1830,7 +1830,7 @@ static int32 GPS_Input_Get_D155(GPS_PWay *way, FILE *inf) ** @return [int32] number of entries ************************************************************************/ -int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf) +int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf) { char s[GPS_ARB_LEN]; int32 n; @@ -1848,7 +1848,7 @@ int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf) return gps_errno; } - if (sscanf(s,"Track log %d%d",(int *)&a,(int *)&d)!=2) { + if (sscanf(s,"Track log %d%d",(int*)&a,(int*)&d)!=2) { return INPUT_ERROR; } @@ -1876,7 +1876,7 @@ int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf) fseek(inf,pos,0); - if (!(*trk=(GPS_PTrack *)malloc(n*sizeof(GPS_PTrack *)))) { + if (!(*trk=(GPS_PTrack*)malloc(n*sizeof(GPS_PTrack*)))) { return MEMORY_ERROR; } for (i=0; idspl = x; @@ -1972,7 +1972,7 @@ static int32 GPS_Input_Get_Track301(GPS_PTrack **trk, FILE *inf, int32 type, return gps_errno; } p=strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&x)!=1) { + if (sscanf(p+1,"%d",(int*)&x)!=1) { return INPUT_ERROR; } (*trk)[i]->colour = x; @@ -2019,9 +2019,9 @@ static int32 GPS_Input_Get_Track301(GPS_PTrack **trk, FILE *inf, int32 type, ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D300(GPS_PTrack *trk, FILE *inf, char *s) +static int32 GPS_Input_Get_D300(GPS_PTrack* trk, FILE* inf, char* s) { - char *p; + char* p; double f; p=strchr(s,':'); @@ -2060,9 +2060,9 @@ static int32 GPS_Input_Get_D300(GPS_PTrack *trk, FILE *inf, char *s) ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_D301(GPS_PTrack *trk, FILE *inf, char *s) +static int32 GPS_Input_Get_D301(GPS_PTrack* trk, FILE* inf, char* s) { - char *p; + char* p; double f; p=strchr(s,':'); @@ -2118,7 +2118,7 @@ static int32 GPS_Input_Get_D301(GPS_PTrack *trk, FILE *inf, char *s) ** @return [int32] number of entries ************************************************************************/ -int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) +int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf) { char s[GPS_ARB_LEN]; int32 n; @@ -2128,7 +2128,7 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) int32 i; long pos; int32 ret; - char *p; + char* p; int32 d; gps_errno = INPUT_ERROR; @@ -2137,7 +2137,7 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Route log %d",(int *)&atype)!=1) { + if (sscanf(s,"Route log %d",(int*)&atype)!=1) { return gps_errno; } if (!GPS_Input_Read_Line(s,inf)) { @@ -2158,14 +2158,14 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Route Type: %d",(int *)&rtype)!=1) { + if (sscanf(s,"Route Type: %d",(int*)&rtype)!=1) { return gps_errno; } if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) { + if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) { return gps_errno; } @@ -2189,7 +2189,7 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) fseek(inf,0L,0); - if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) { + if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) { return MEMORY_ERROR; } for (i=0; irte_num=d; @@ -2226,7 +2226,7 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) case 201: p = strchr(s,':'); p = strchr(p+1,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_error; } (*way)[i]->rte_num=d; @@ -2366,7 +2366,7 @@ int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf) ** @return [int32] number of entries ************************************************************************/ -static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) +static int32 GPS_Input_Get_Route201(GPS_PWay** way, FILE* inf) { char s[GPS_ARB_LEN]; int32 n; @@ -2375,7 +2375,7 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) int32 i; long pos; int32 ret; - char *p; + char* p; int32 d; gps_errno = INPUT_ERROR; @@ -2383,14 +2383,14 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Route Type: %d",(int *)&rtype)!=1) { + if (sscanf(s,"Route Type: %d",(int*)&rtype)!=1) { return gps_errno; } if (!GPS_Input_Read_Line(s,inf)) { return gps_errno; } - if (sscanf(s,"Waypoints Type: %d",(int *)&type)!=1) { + if (sscanf(s,"Waypoints Type: %d",(int*)&type)!=1) { return gps_errno; } @@ -2407,7 +2407,7 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) } fseek(inf,0L,0); - if (!(*way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *)))) { + if (!(*way=(GPS_PWay*)malloc(n*sizeof(GPS_PWay*)))) { return MEMORY_ERROR; } for (i=0; irte_num=d; @@ -2444,7 +2444,7 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) case 201: p = strchr(s,':'); p = strchr(p+1,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_error; } (*way)[i]->rte_num=d; @@ -2471,7 +2471,7 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) (*way)[i]->islink = 1; p = strchr(s,':'); - if (sscanf(p+1,"%d",(int *)&d)!=1) { + if (sscanf(p+1,"%d",(int*)&d)!=1) { return gps_error; } (*way)[i]->rte_link_class=d; @@ -2483,13 +2483,13 @@ static int32 GPS_Input_Get_Route201(GPS_PWay **way, FILE *inf) } GPS_Input_Load_String((*way)[i]->rte_link_subclass,18,s); } else { - GPS_Util_Put_Short((UC *)(*way)[i]->rte_link_subclass,0); - GPS_Util_Put_Int((UC *)(*way)[i]->rte_link_subclass+2,0); - GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+6, + GPS_Util_Put_Short((UC*)(*way)[i]->rte_link_subclass,0); + GPS_Util_Put_Int((UC*)(*way)[i]->rte_link_subclass+2,0); + GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+6, 0xffffffff); - GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+10, + GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+10, 0xffffffff); - GPS_Util_Put_Uint((UC *)(*way)[i]->rte_link_subclass+14, + GPS_Util_Put_Uint((UC*)(*way)[i]->rte_link_subclass+14, 0xffffffff); } diff --git a/gpsbabel/jeeps/gpsinput.h b/gpsbabel/jeeps/gpsinput.h index b8dc1ec64..78c7d73f9 100644 --- a/gpsbabel/jeeps/gpsinput.h +++ b/gpsbabel/jeeps/gpsinput.h @@ -9,11 +9,11 @@ extern "C" #include "gps.h" - int32 GPS_Input_Get_Almanac(GPS_PAlmanac **alm, FILE *inf); - int32 GPS_Input_Get_Waypoint(GPS_PWay **way, FILE *inf); - int32 GPS_Input_Get_Proximity(GPS_PWay **way, FILE *inf); - int32 GPS_Input_Get_Track(GPS_PTrack **trk, FILE *inf); - int32 GPS_Input_Get_Route(GPS_PWay **way, FILE *inf); + int32 GPS_Input_Get_Almanac(GPS_PAlmanac** alm, FILE* inf); + int32 GPS_Input_Get_Waypoint(GPS_PWay** way, FILE* inf); + int32 GPS_Input_Get_Proximity(GPS_PWay** way, FILE* inf); + int32 GPS_Input_Get_Track(GPS_PTrack** trk, FILE* inf); + int32 GPS_Input_Get_Route(GPS_PWay** way, FILE* inf); #endif diff --git a/gpsbabel/jeeps/gpslibusb.c b/gpsbabel/jeeps/gpslibusb.c index ef1206b49..acb732c78 100644 --- a/gpsbabel/jeeps/gpslibusb.c +++ b/gpsbabel/jeeps/gpslibusb.c @@ -47,7 +47,7 @@ #define TMOUT_B 5000 /* Milliseconds to timeout bulk pipe access. */ typedef struct { - struct usb_bus *busses; + struct usb_bus* busses; unsigned product_id; } libusb_unit_data; @@ -59,14 +59,14 @@ static int gusb_intr_in_ep; static int gusb_bulk_out_ep; static int gusb_bulk_in_ep; -static usb_dev_handle *udev; -static int garmin_usb_scan(libusb_unit_data *, int); -static const gdx_info *gdx; +static usb_dev_handle* udev; +static int garmin_usb_scan(libusb_unit_data*, int); +static const gdx_info* gdx; -static int gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz); -static int gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz); -static int gusb_teardown(gpsdevh *dh); -static int gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz); +static int gusb_libusb_get(garmin_usb_packet* ibuf, size_t sz); +static int gusb_libusb_get_bulk(garmin_usb_packet* ibuf, size_t sz); +static int gusb_teardown(gpsdevh* dh); +static int gusb_libusb_send(const garmin_usb_packet* opkt, size_t sz); static gusb_llops_t libusb_llops = { gusb_libusb_get, @@ -78,7 +78,7 @@ static gusb_llops_t libusb_llops = { #if __linux__ static -char ** os_get_garmin_mountpoints() +char** os_get_garmin_mountpoints() { // Hacked for testing. return NULL; @@ -88,15 +88,15 @@ char ** os_get_garmin_mountpoints() // vendor ID and match that against the mounted device table. In practical // matters, that's crazy complex and this is where the devices seems to always // get mounted... -char ** os_get_garmin_mountpoints() +char** os_get_garmin_mountpoints() { - char **dlist = (char **) xcalloc(2, sizeof *dlist); + char** dlist = (char**) xcalloc(2, sizeof *dlist); dlist[0] = xstrdup("/Volumes/GARMIN"); dlist[1] = NULL; return dlist; } #else -char ** os_get_garmin_mountpoints() +char** os_get_garmin_mountpoints() { return NULL; } @@ -104,10 +104,10 @@ char ** os_get_garmin_mountpoints() static int -gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz) +gusb_libusb_send(const garmin_usb_packet* opkt, size_t sz) { int r; - r = usb_bulk_write(udev, gusb_bulk_out_ep, (char *)(void *)opkt->dbuf, sz, TMOUT_B); + r = usb_bulk_write(udev, gusb_bulk_out_ep, (char*)(void*)opkt->dbuf, sz, TMOUT_B); if (r != (int) sz) { fprintf(stderr, "Bad cmdsend r %d sz %ld\n", r, (unsigned long) sz); @@ -121,29 +121,29 @@ gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz) } static int -gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz) +gusb_libusb_get(garmin_usb_packet* ibuf, size_t sz) { - unsigned char *buf = &ibuf->dbuf[0]; + unsigned char* buf = &ibuf->dbuf[0]; int r = -1; - r = usb_interrupt_read(udev, gusb_intr_in_ep, (char *) buf, sz, TMOUT_I); + r = usb_interrupt_read(udev, gusb_intr_in_ep, (char*) buf, sz, TMOUT_I); return r; } static int -gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz) +gusb_libusb_get_bulk(garmin_usb_packet* ibuf, size_t sz) { int r; - unsigned char *buf = &ibuf->dbuf[0]; + unsigned char* buf = &ibuf->dbuf[0]; - r = usb_bulk_read(udev, gusb_bulk_in_ep, (char *) buf, sz, TMOUT_B); + r = usb_bulk_read(udev, gusb_bulk_in_ep, (char*) buf, sz, TMOUT_B); return r; } static int -gusb_teardown(gpsdevh *dh) +gusb_teardown(gpsdevh* dh) { if (udev) { usb_release_interface(udev, 0); @@ -220,9 +220,9 @@ gusb_reset_toggles(void) * #3 actually starts the session now that the above are both clear. */ - gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit)); - gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit)); - gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit)); + gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit)); + gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit)); + gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit)); t = 10; while (1) { @@ -249,7 +249,7 @@ gusb_reset_toggles(void) */ t = 10; - gusb_cmd_send((const garmin_usb_packet *) oid, sizeof(oid)); + gusb_cmd_send((const garmin_usb_packet*) oid, sizeof(oid)); while (1) { le_write16(&iresp.gusb_pkt.pkt_id, 0); le_write32(&iresp.gusb_pkt.datasz, 0); @@ -272,7 +272,7 @@ gusb_reset_toggles(void) } void -garmin_usb_start(struct usb_device *dev, libusb_unit_data *lud) +garmin_usb_start(struct usb_device* dev, libusb_unit_data* lud) { int i; @@ -338,7 +338,7 @@ garmin_usb_start(struct usb_device *dev, libusb_unit_data *lud) } for (i = 0; i < dev->config->interface->altsetting->bNumEndpoints; i++) { - struct usb_endpoint_descriptor * ep; + struct usb_endpoint_descriptor* ep; ep = &dev->config->interface->altsetting->endpoint[i]; switch (ep->bmAttributes & USB_ENDPOINT_TYPE_MASK) { @@ -393,13 +393,13 @@ garmin_usb_start(struct usb_device *dev, libusb_unit_data *lud) } static -int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number) +int garmin_usb_scan(libusb_unit_data* lud, int req_unit_number) { int found_devices = 0; - struct usb_bus *bus; + struct usb_bus* bus; for (bus = lud->busses; bus; bus = bus->next) { - struct usb_device *dev; + struct usb_device* dev; for (dev = bus->devices; dev; dev = dev->next) { /* @@ -442,7 +442,7 @@ int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number) * that is wants to read and write GPX files on a * mounted drive. Try that now. */ - char **dlist = os_get_garmin_mountpoints(); + char** dlist = os_get_garmin_mountpoints(); gdx = gdx_find_file(dlist); if (gdx) { return 1; @@ -456,10 +456,10 @@ int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number) int -gusb_init(const char *portname, gpsdevh **dh) +gusb_init(const char* portname, gpsdevh** dh) { int req_unit_number = 0; - libusb_unit_data *lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1); + libusb_unit_data* lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1); *dh = (gpsdevh*) lud; diff --git a/gpsbabel/jeeps/gpsmath.c b/gpsbabel/jeeps/gpsmath.c index a26f8f0c8..1a025012d 100644 --- a/gpsbabel/jeeps/gpsmath.c +++ b/gpsbabel/jeeps/gpsmath.c @@ -28,11 +28,11 @@ #include "gpsdatum.h" -static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32 *zone, - char *zc, double *Mc, double *E0, - double *N0, double *F0); -static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double *Mc, - double *E0, double *N0, double *F0); +static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32* zone, + char* zc, double* Mc, double* E0, + double* N0, double* F0); +static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double* Mc, + double* E0, double* N0, double* F0); @@ -79,7 +79,7 @@ double GPS_Math_Rad_To_Deg(double v) ** @return [void] ************************************************************************/ -void GPS_Math_Deg_To_DegMin(double v, int32 *d, double *m) +void GPS_Math_Deg_To_DegMin(double v, int32* d, double* m) { int32 sign; @@ -117,7 +117,7 @@ void GPS_Math_Deg_To_DegMin(double v, int32 *d, double *m) ** @return [void] ************************************************************************/ -void GPS_Math_DegMin_To_Deg(int32 d, double m, double *deg) +void GPS_Math_DegMin_To_Deg(int32 d, double m, double* deg) { *deg = ((double)abs(d)) + m / (double)60.0; @@ -142,7 +142,7 @@ void GPS_Math_DegMin_To_Deg(int32 d, double m, double *deg) ** @return [void] ************************************************************************/ -void GPS_Math_Deg_To_DegMinSec(double v, int32 *d, int32 *m, double *s) +void GPS_Math_Deg_To_DegMinSec(double v, int32* d, int32* m, double* s) { int32 sign; double t; @@ -193,7 +193,7 @@ void GPS_Math_Deg_To_DegMinSec(double v, int32 *d, int32 *m, double *s) ** @return [void] ************************************************************************/ -void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double *deg) +void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double* deg) { *deg = ((double)abs(d)) + ((double)m + s / (double)60.0) / (double)60.0; @@ -320,7 +320,7 @@ time_t GPS_Math_Gtime_To_Utime(time_t v) ** @return [void] ************************************************************************/ void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z, + double* x, double* y, double* z, double a, double b) { double esq; @@ -358,7 +358,7 @@ void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H, ** ** @return [void] ************************************************************************/ -void GPS_Math_XYZ_To_LatLonH(double *phi, double *lambda, double *H, +void GPS_Math_XYZ_To_LatLonH(double* phi, double* lambda, double* H, double x, double y, double z, double a, double b) { @@ -419,7 +419,7 @@ void GPS_Math_XYZ_To_LatLonH(double *phi, double *lambda, double *H, ** @return [void] ************************************************************************/ void GPS_Math_Airy1830LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z) + double* x, double* y, double* z) { double a = 6377563.396; double b = 6356256.910; @@ -446,7 +446,7 @@ void GPS_Math_Airy1830LatLonH_To_XYZ(double phi, double lambda, double H, ** @return [void] ************************************************************************/ void GPS_Math_WGS84LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z) + double* x, double* y, double* z) { double a = 6378137.000; double b = 6356752.3141; @@ -472,7 +472,7 @@ void GPS_Math_WGS84LatLonH_To_XYZ(double phi, double lambda, double H, ** ** @return [void] ************************************************************************/ -void GPS_Math_XYZ_To_Airy1830LatLonH(double *phi, double *lambda, double *H, +void GPS_Math_XYZ_To_Airy1830LatLonH(double* phi, double* lambda, double* H, double x, double y, double z) { double a = 6377563.396; @@ -498,7 +498,7 @@ void GPS_Math_XYZ_To_Airy1830LatLonH(double *phi, double *lambda, double *H, ** ** @return [void] ************************************************************************/ -void GPS_Math_XYZ_To_WGS84LatLonH(double *phi, double *lambda, double *H, +void GPS_Math_XYZ_To_WGS84LatLonH(double* phi, double* lambda, double* H, double x, double y, double z) { double a = 6378137.000; @@ -529,7 +529,7 @@ void GPS_Math_XYZ_To_WGS84LatLonH(double *phi, double *lambda, double *H, ** ** @return [void] ************************************************************************/ -void GPS_Math_LatLon_To_EN(double *E, double *N, double phi, +void GPS_Math_LatLon_To_EN(double* E, double* N, double phi, double lambda, double N0, double E0, double phi0, double lambda0, double F0, double a, double b) @@ -627,8 +627,8 @@ void GPS_Math_LatLon_To_EN(double *E, double *N, double phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double *E, - double *N) +void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double* E, + double* N) { double N0 = 250000; double E0 = 200000; @@ -658,8 +658,8 @@ void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double *E, - double *N) +void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double* E, + double* N) { double N0 = -100000; double E0 = 400000; @@ -689,8 +689,8 @@ void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double *E, ** @return [void] ************************************************************************/ -int32 GPS_Math_WGS84_To_Swiss_EN(double lat, double lon, double *E, - double *N) +int32 GPS_Math_WGS84_To_Swiss_EN(double lat, double lon, double* E, + double* N) { const double phi0 = 46.95240556; const double lambda0 = 7.43958333; @@ -727,7 +727,7 @@ int32 GPS_Math_WGS84_To_Swiss_EN(double lat, double lon, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double *lat, double *lon) +void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon) { const double phi0 = 46.95240556; const double lambda0 = 7.43958333; @@ -761,8 +761,8 @@ void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double *lat, double *lon) ** ** @return [void] ************************************************************************/ -void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, +void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -907,8 +907,8 @@ void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { @@ -1081,8 +1081,8 @@ void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi, ** @return [void] ************************************************************************/ -int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double *E, - double *N) +int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double* E, + double* N) { double const phi0 = 31.73409694444; // 31 44 2.749 double const lambda0 = 35.21208055556; // 35 12 43.49 @@ -1116,7 +1116,7 @@ int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_ICS_EN_To_WGS84(double E, double N, double *lat, double *lon) +void GPS_Math_ICS_EN_To_WGS84(double E, double N, double* lat, double* lon) { double const phi0 = 31.73409694444; // 31 44 2.749 double const lambda0 = 35.21208055556; // 35 12 43.49 @@ -1154,8 +1154,8 @@ void GPS_Math_ICS_EN_To_WGS84(double E, double N, double *lat, double *lon) ** ** @return [void] ************************************************************************/ -void GPS_Math_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double N0, double E0, +void GPS_Math_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double N0, double E0, double phi0, double lambda0, double F0, double a, double b) { @@ -1280,8 +1280,8 @@ void GPS_Math_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_NGENToAiry1830LatLon(double E, double N, double *phi, - double *lambda) +void GPS_Math_NGENToAiry1830LatLon(double E, double N, double* phi, + double* lambda) { double N0 = -100000; double E0 = 400000; @@ -1310,8 +1310,8 @@ void GPS_Math_NGENToAiry1830LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double *phi, - double *lambda) +void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double* phi, + double* lambda) { double N0 = 250000; double E0 = 200000; @@ -1341,8 +1341,8 @@ void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double *phi, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double *mE, - double *mN, char *map) +int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double* mE, + double* mN, char* map) { int32 t; int32 idx; @@ -1380,8 +1380,8 @@ int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double *mE, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UKOSNG_Map_To_EN(char *map, double mapE, double mapN, double *E, - double *N) +int32 GPS_Math_UKOSNG_Map_To_EN(char* map, double mapE, double mapN, double* E, + double* N) { int32 t; int32 idx; @@ -1435,8 +1435,8 @@ int32 GPS_Math_UKOSNG_Map_To_EN(char *map, double mapE, double mapN, double *E, ** @return [void] ************************************************************************/ void GPS_Math_Molodensky(double Sphi, double Slam, double SH, double Sa, - double Sif, double *Dphi, double *Dlam, - double *DH, double Da, double Dif, double dx, + double Sif, double* Dphi, double* Dlam, + double* DH, double Da, double Dif, double dx, double dy, double dz) { double Sf; @@ -1515,7 +1515,7 @@ void GPS_Math_Molodensky(double Sphi, double Slam, double SH, double Sa, ** @return [void] ************************************************************************/ void GPS_Math_Known_Datum_To_WGS84_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n) { double Sa; @@ -1559,7 +1559,7 @@ void GPS_Math_Known_Datum_To_WGS84_M(double Sphi, double Slam, double SH, ** @return [void] ************************************************************************/ void GPS_Math_WGS84_To_Known_Datum_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n) { double Sa; @@ -1603,7 +1603,7 @@ void GPS_Math_WGS84_To_Known_Datum_M(double Sphi, double Slam, double SH, ** @return [void] ************************************************************************/ void GPS_Math_Known_Datum_To_WGS84_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n) { double Sa; @@ -1660,7 +1660,7 @@ void GPS_Math_Known_Datum_To_WGS84_C(double Sphi, double Slam, double SH, ** @return [void] ************************************************************************/ void GPS_Math_WGS84_To_Known_Datum_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n) { double Sa; @@ -1718,8 +1718,8 @@ void GPS_Math_WGS84_To_Known_Datum_C(double Sphi, double Slam, double SH, ** @return [void] ************************************************************************/ void GPS_Math_Known_Datum_To_Known_Datum_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, - double *DH, int32 n1, int32 n2) + double* Dphi, double* Dlam, + double* DH, int32 n1, int32 n2) { double Sa; double Sif; @@ -1780,8 +1780,8 @@ void GPS_Math_Known_Datum_To_Known_Datum_M(double Sphi, double Slam, double SH, ** @return [void] ************************************************************************/ void GPS_Math_Known_Datum_To_Known_Datum_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, - double *DH, int32 n1, int32 n2) + double* Dphi, double* Dlam, + double* DH, int32 n1, int32 n2) { double Sa; double Sif; @@ -1846,8 +1846,8 @@ void GPS_Math_Known_Datum_To_Known_Datum_C(double Sphi, double Slam, double SH, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double *mE, - double *mN, char *map) +int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double* mE, + double* mN, char* map) { double alat; double alon; @@ -1882,8 +1882,8 @@ int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double *mE, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UKOSMap_To_WGS84_M(char *map, double mE, double mN, - double *lat, double *lon) +int32 GPS_Math_UKOSMap_To_WGS84_M(char* map, double mE, double mN, + double* lat, double* lon) { double E; double N; @@ -1917,8 +1917,8 @@ int32 GPS_Math_UKOSMap_To_WGS84_M(char *map, double mE, double mN, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double *mE, - double *mN, char *map) +int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double* mE, + double* mN, char* map) { double alat; double alon; @@ -1953,8 +1953,8 @@ int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double *mE, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UKOSMap_To_WGS84_C(char *map, double mE, double mN, - double *lat, double *lon) +int32 GPS_Math_UKOSMap_To_WGS84_C(char* map, double mE, double mN, + double* lat, double* lon) { double E; double N; @@ -1989,9 +1989,9 @@ int32 GPS_Math_UKOSMap_To_WGS84_C(char *map, double mE, double mN, ** ** @return [int32] success ************************************************************************/ -static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32 *zone, - char *zc, double *Mc, double *E0, - double *N0, double *F0) +static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32* zone, + char* zc, double* Mc, double* E0, + double* N0, double* F0) { int32 ilon; int32 ilat; @@ -2084,8 +2084,8 @@ static int32 GPS_Math_LatLon_To_UTM_Param(double lat, double lon, int32 *zone, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc) +int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc) { double phi0; double lambda0; @@ -2125,8 +2125,8 @@ int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double *E, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc) +int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc) { double phi; double lambda; @@ -2156,8 +2156,8 @@ int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double *E, ** ** @return [int32] success ************************************************************************/ -static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double *Mc, - double *E0, double *N0, double *F0) +static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double* Mc, + double* E0, double* N0, double* F0) { if (zone>60 || zone<0 || zc<'C' || zc>'X') { @@ -2214,7 +2214,7 @@ static int32 GPS_Math_UTM_Param_To_Mc(int32 zone, char zc, double *Mc, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UTM_EN_To_NAD83(double *lat, double *lon, double E, +int32 GPS_Math_UTM_EN_To_NAD83(double* lat, double* lon, double E, double N, int32 zone, char zc) { return GPS_Math_UTM_EN_To_Known_Datum(lat, lon, E, N, zone, zc, 77); @@ -2235,7 +2235,7 @@ int32 GPS_Math_UTM_EN_To_NAD83(double *lat, double *lon, double E, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UTM_EN_To_WGS84(double *lat, double *lon, double E, +int32 GPS_Math_UTM_EN_To_WGS84(double* lat, double* lon, double E, double N, int32 zone, char zc) { double lambda0; @@ -2266,8 +2266,8 @@ int32 GPS_Math_UTM_EN_To_WGS84(double *lat, double *lon, double E, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc, const int n) +int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc, const int n) { double phi0; double lambda0; @@ -2308,7 +2308,7 @@ int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double *E, ** ** @return [int32] success ************************************************************************/ -int32 GPS_Math_UTM_EN_To_Known_Datum(double *lat, double *lon, double E, +int32 GPS_Math_UTM_EN_To_Known_Datum(double* lat, double* lon, double E, double N, int32 zone, char zc, const int n) { double lambda0; @@ -2343,8 +2343,8 @@ int32 GPS_Math_UTM_EN_To_Known_Datum(double *lat, double *lon, double E, ** ** @return [void] ***************************************************************************/ -void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, - double *N,double phi0,double lambda0, +void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, + double* N,double phi0,double lambda0, double E0, double N0, double a, double b) { @@ -2424,8 +2424,8 @@ void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, ** @return [void] *************************************************************************/ -void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, +void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b) { double a2; @@ -2497,7 +2497,7 @@ void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi, void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid, const double UTMNorthing, const double UTMEasting, - double *Lat, double *Lon, + double* Lat, double* Lon, const double lambda0, const double E0, const double N0) @@ -2552,7 +2552,7 @@ void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid, /********************************************************************/ -int32 GPS_Lookup_Datum_Index(const char *n) +int32 GPS_Lookup_Datum_Index(const char* n) { GPS_PDatum dp; GPS_PDatum_Alias al; @@ -2572,7 +2572,7 @@ int32 GPS_Lookup_Datum_Index(const char *n) return -1; } -char * +char* GPS_Math_Get_Datum_Name(const int datum_index) { return GPS_Datum[datum_index].name; diff --git a/gpsbabel/jeeps/gpsmath.h b/gpsbabel/jeeps/gpsmath.h index 3bab7217e..c1ac21145 100644 --- a/gpsbabel/jeeps/gpsmath.h +++ b/gpsbabel/jeeps/gpsmath.h @@ -26,122 +26,122 @@ extern "C" time_t GPS_Math_Utime_To_Gtime(time_t v); time_t GPS_Math_Gtime_To_Utime(time_t v); - void GPS_Math_Deg_To_DegMin(double v, int32 *d, double *m); - void GPS_Math_DegMin_To_Deg(int32 d, double m, double *deg); - void GPS_Math_Deg_To_DegMinSec(double v, int32 *d, int32 *m, double *s); - void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double *deg); + void GPS_Math_Deg_To_DegMin(double v, int32* d, double* m); + void GPS_Math_DegMin_To_Deg(int32 d, double m, double* deg); + void GPS_Math_Deg_To_DegMinSec(double v, int32* d, int32* m, double* s); + void GPS_Math_DegMinSec_To_Deg(int32 d, int32 m, double s, double* deg); - void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double *E, - double *N); - void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double *E, - double *N); - int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double *mE, - double *mN, char *map); - int32 GPS_Math_UKOSNG_Map_To_EN(char *map, double mapE, double mapN, - double *E, double *N); + void GPS_Math_Airy1830LatLonToNGEN(double phi, double lambda, double* E, + double* N); + void GPS_Math_Airy1830M_LatLonToINGEN(double phi, double lambda, double* E, + double* N); + int32 GPS_Math_EN_To_UKOSNG_Map(double E, double N, double* mE, + double* mN, char* map); + int32 GPS_Math_UKOSNG_Map_To_EN(char* map, double mapE, double mapN, + double* E, double* N); void GPS_Math_LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z, + double* x, double* y, double* z, double a, double b); - void GPS_Math_XYZ_To_LatLonH(double *phi, double *lambda, double *H, + void GPS_Math_XYZ_To_LatLonH(double* phi, double* lambda, double* H, double x, double y, double z, double a, double b); - void GPS_Math_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double N0, double E0, + void GPS_Math_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double N0, double E0, double phi0, double lambda0, double F0, double a, double b); - void GPS_Math_LatLon_To_EN(double *E, double *N, double phi, + void GPS_Math_LatLon_To_EN(double* E, double* N, double phi, double lambda, double N0, double E0, double phi0, double lambda0, double F0, double a, double b); - void GPS_Math_NGENToAiry1830LatLon(double E, double N, double *phi, - double *lambda); - void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double *phi, - double *lambda); + void GPS_Math_NGENToAiry1830LatLon(double E, double N, double* phi, + double* lambda); + void GPS_Math_INGENToAiry1830MLatLon(double E, double N, double* phi, + double* lambda); void GPS_Math_Airy1830LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z); + double* x, double* y, double* z); void GPS_Math_WGS84LatLonH_To_XYZ(double phi, double lambda, double H, - double *x, double *y, double *z); - void GPS_Math_XYZ_To_Airy1830LatLonH(double *phi, double *lambda, double *H, + double* x, double* y, double* z); + void GPS_Math_XYZ_To_Airy1830LatLonH(double* phi, double* lambda, double* H, double x, double y, double z); - void GPS_Math_XYZ_To_WGS84LatLonH(double *phi, double *lambda, double *H, + void GPS_Math_XYZ_To_WGS84LatLonH(double* phi, double* lambda, double* H, double x, double y, double z); void GPS_Math_Molodensky(double Sphi, double Slam, double SH, double Sa, - double Sif, double *Dphi, double *Dlam, - double *DH, double Da, double Dif, double dx, + double Sif, double* Dphi, double* Dlam, + double* DH, double Da, double Dif, double dx, double dy, double dz); void GPS_Math_Known_Datum_To_WGS84_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n); void GPS_Math_WGS84_To_Known_Datum_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n); void GPS_Math_Known_Datum_To_WGS84_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n); void GPS_Math_WGS84_To_Known_Datum_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, double *DH, + double* Dphi, double* Dlam, double* DH, int32 n); void GPS_Math_Known_Datum_To_Known_Datum_M(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, - double *DH, int32 n1, int32 n2); + double* Dphi, double* Dlam, + double* DH, int32 n1, int32 n2); void GPS_Math_Known_Datum_To_Known_Datum_C(double Sphi, double Slam, double SH, - double *Dphi, double *Dlam, - double *DH, int32 n1, int32 n2); + double* Dphi, double* Dlam, + double* DH, int32 n1, int32 n2); - int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double *mE, - double *mN, char *map); - int32 GPS_Math_UKOSMap_To_WGS84_M(char *map, double mE, double mN, - double *lat, double *lon); - int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double *mE, - double *mN, char *map); - int32 GPS_Math_UKOSMap_To_WGS84_C(char *map, double mE, double mN, - double *lat, double *lon); + int32 GPS_Math_WGS84_To_UKOSMap_M(double lat, double lon, double* mE, + double* mN, char* map); + int32 GPS_Math_UKOSMap_To_WGS84_M(char* map, double mE, double mN, + double* lat, double* lon); + int32 GPS_Math_WGS84_To_UKOSMap_C(double lat, double lon, double* mE, + double* mN, char* map); + int32 GPS_Math_UKOSMap_To_WGS84_C(char* map, double mE, double mN, + double* lat, double* lon); - int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc); - int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc); + int32 GPS_Math_NAD83_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc); + int32 GPS_Math_WGS84_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc); - int32 GPS_Math_UTM_EN_To_WGS84(double *lat, double *lon, double E, + int32 GPS_Math_UTM_EN_To_WGS84(double* lat, double* lon, double E, double N, int32 zone, char zc); - int32 GPS_Math_UTM_EN_To_NAD83(double *lat, double *lon, double E, + int32 GPS_Math_UTM_EN_To_NAD83(double* lat, double* lon, double E, double N, int32 zone, char zc); - int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double *E, - double *N, int32 *zone, char *zc, const int n); - int32 GPS_Math_UTM_EN_To_Known_Datum(double *lat, double *lon, double E, + int32 GPS_Math_Known_Datum_To_UTM_EN(double lat, double lon, double* E, + double* N, int32* zone, char* zc, const int n); + int32 GPS_Math_UTM_EN_To_Known_Datum(double* lat, double* lon, double E, double N, int32 zone, char zc, const int n); - void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, - double *N,double phi0,double lambda0, + void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, + double* N,double phi0,double lambda0, double E0, double N0, double a, double b); - void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, + void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b); - int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double *E, - double *N); - void GPS_Math_ICS_EN_To_WGS84(double E, double N, double *lat, double *lon); + int32 GPS_Math_WGS84_To_ICS_EN(double lat, double lon, double* E, + double* N); + void GPS_Math_ICS_EN_To_WGS84(double E, double N, double* lat, double* lon); - int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double *E, double *N); - void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double *lat, double *lon); + int32 GPS_Math_WGS84_To_Swiss_EN(double phi, double lambda, double* E, double* N); + void GPS_Math_Swiss_EN_To_WGS84(double E, double N, double* lat, double* lon); void GPS_Math_UTM_EN_to_LatLon(int ReferenceEllipsoid, const double UTMNorthing, const double UTMEasting, - double *Lat, double *Lon, + double* Lat, double* Lon, const double lambda0, const double E0, const double N0); - int32 GPS_Lookup_Datum_Index(const char *n); - char *GPS_Math_Get_Datum_Name(const int datum_index); + int32 GPS_Lookup_Datum_Index(const char* n); + char* GPS_Math_Get_Datum_Name(const int datum_index); #endif diff --git a/gpsbabel/jeeps/gpsmem.c b/gpsbabel/jeeps/gpsmem.c index 3530a7fda..bc0923532 100644 --- a/gpsbabel/jeeps/gpsmem.c +++ b/gpsbabel/jeeps/gpsmem.c @@ -49,7 +49,7 @@ GPS_PPacket GPS_Packet_New(void) fflush(stderr); return NULL; } - if (!(ret->data = (UC *)calloc(1, MAX_GPS_PACKET_SIZE*sizeof(UC)))) { + if (!(ret->data = (UC*)calloc(1, MAX_GPS_PACKET_SIZE*sizeof(UC)))) { perror("malloc"); fprintf(stderr,"GPS_Packet_New: Insufficient data memory"); fflush(stderr); @@ -69,10 +69,10 @@ GPS_PPacket GPS_Packet_New(void) ** @return [void] **********************************************************************/ -void GPS_Packet_Del(GPS_PPacket *thys) +void GPS_Packet_Del(GPS_PPacket* thys) { - free((void *)(*thys)->data); - free((void *)*thys); + free((void*)(*thys)->data); + free((void*)*thys); return; } @@ -111,9 +111,9 @@ GPS_PPvt_Data GPS_Pvt_New(void) ** @return [void] **********************************************************************/ -void GPS_Pvt_Del(GPS_PPvt_Data *thys) +void GPS_Pvt_Del(GPS_PPvt_Data* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -156,9 +156,9 @@ GPS_PAlmanac GPS_Almanac_New(void) ** @return [void] **********************************************************************/ -void GPS_Almanac_Del(GPS_PAlmanac *thys) +void GPS_Almanac_Del(GPS_PAlmanac* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -197,9 +197,9 @@ GPS_PTrack GPS_Track_New(void) ** @return [void] **********************************************************************/ -void GPS_Track_Del(GPS_PTrack *thys) +void GPS_Track_Del(GPS_PTrack* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -287,9 +287,9 @@ GPS_PWay GPS_Way_New(void) ** @return [void] **********************************************************************/ -void GPS_Way_Del(GPS_PWay *thys) +void GPS_Way_Del(GPS_PWay* thys) { - xfree((void *)*thys); + xfree((void*)*thys); return; } @@ -326,9 +326,9 @@ GPS_PLap GPS_Lap_New(void) ** @return [void] **********************************************************************/ -void GPS_Lap_Del(GPS_PLap *thys) +void GPS_Lap_Del(GPS_PLap* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -364,9 +364,9 @@ GPS_PCourse GPS_Course_New(void) ** ** @return [void] **********************************************************************/ -void GPS_Course_Del(GPS_PCourse *thys) +void GPS_Course_Del(GPS_PCourse* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -403,9 +403,9 @@ GPS_PCourse_Lap GPS_Course_Lap_New(void) ** @return [void] **********************************************************************/ -void GPS_Course_Lap_Del(GPS_PCourse_Lap *thys) +void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys) { - free((void *)*thys); + free((void*)*thys); return; } @@ -442,9 +442,9 @@ GPS_PCourse_Point GPS_Course_Point_New(void) ** @return [void] **********************************************************************/ -void GPS_Course_Point_Del(GPS_PCourse_Point *thys) +void GPS_Course_Point_Del(GPS_PCourse_Point* thys) { - free((void *)*thys); + free((void*)*thys); return; } diff --git a/gpsbabel/jeeps/gpsmem.h b/gpsbabel/jeeps/gpsmem.h index e5f29ee39..bcf9e71cc 100644 --- a/gpsbabel/jeeps/gpsmem.h +++ b/gpsbabel/jeeps/gpsmem.h @@ -10,23 +10,23 @@ extern "C" #include "gps.h" GPS_PPacket GPS_Packet_New(void); - void GPS_Packet_Del(GPS_PPacket *thys); + void GPS_Packet_Del(GPS_PPacket* thys); GPS_PPvt_Data GPS_Pvt_New(void); - void GPS_Pvt_Del(GPS_PPvt_Data *thys); + void GPS_Pvt_Del(GPS_PPvt_Data* thys); GPS_PAlmanac GPS_Almanac_New(void); - void GPS_Almanac_Del(GPS_PAlmanac *thys); + void GPS_Almanac_Del(GPS_PAlmanac* thys); GPS_PTrack GPS_Track_New(void); - void GPS_Track_Del(GPS_PTrack *thys); + void GPS_Track_Del(GPS_PTrack* thys); GPS_PWay GPS_Way_New(void); - void GPS_Way_Del(GPS_PWay *thys); + void GPS_Way_Del(GPS_PWay* thys); GPS_PLap GPS_Lap_New(void); - void GPS_Lap_Del(GPS_PLap *thys); + void GPS_Lap_Del(GPS_PLap* thys); GPS_PCourse GPS_Course_New(void); - void GPS_Course_Del(GPS_PCourse *thys); + void GPS_Course_Del(GPS_PCourse* thys); GPS_PCourse_Lap GPS_Course_Lap_New(void); - void GPS_Course_Lap_Del(GPS_PCourse_Lap *thys); + void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys); GPS_PCourse_Point GPS_Course_Point_New(void); - void GPS_Course_Point_Del(GPS_PCourse_Point *thys); + void GPS_Course_Point_Del(GPS_PCourse_Point* thys); #endif diff --git a/gpsbabel/jeeps/gpsproj.c b/gpsbabel/jeeps/gpsproj.c index 8d1478864..3ecbcf71d 100644 --- a/gpsbabel/jeeps/gpsproj.c +++ b/gpsbabel/jeeps/gpsproj.c @@ -46,8 +46,8 @@ ** ** @return [void] ************************************************************************/ -void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double phi2, +void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b) @@ -184,8 +184,8 @@ void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Albers_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double phi2, +void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b) { @@ -377,8 +377,8 @@ void GPS_Math_Albers_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double phi2, +void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b) @@ -508,8 +508,8 @@ void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double phi2, +void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b) { @@ -675,8 +675,8 @@ void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, +void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double a2; @@ -746,8 +746,8 @@ void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Miller_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_Miller_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double a2; @@ -831,8 +831,8 @@ void GPS_Math_Miller_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, +void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -980,8 +980,8 @@ void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -1156,8 +1156,8 @@ void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, +void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -1302,8 +1302,8 @@ void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { @@ -1480,8 +1480,8 @@ void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, +void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double a2; @@ -1574,8 +1574,8 @@ void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { @@ -1700,8 +1700,8 @@ void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, double N0, +void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double a2; @@ -1796,8 +1796,8 @@ void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double a2; @@ -1903,8 +1903,8 @@ void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, double N0, +void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double a2; @@ -1992,8 +1992,8 @@ void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double a2; @@ -2094,8 +2094,8 @@ void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, +void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -2168,8 +2168,8 @@ void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -2263,8 +2263,8 @@ void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, +void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double po2; @@ -2393,8 +2393,8 @@ void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double po2; @@ -2533,8 +2533,8 @@ void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double lambda1, +void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double lambda1, double E0, double N0, double a, double b) { double p2; @@ -2669,8 +2669,8 @@ void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double lambda1, +void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double lambda1, double E0, double N0, double a, double b) { double p2; @@ -2824,8 +2824,8 @@ void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, +void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double a2; @@ -2911,8 +2911,8 @@ void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double a2; @@ -3017,8 +3017,8 @@ void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, +void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double a, double b) { double p2; @@ -3100,8 +3100,8 @@ void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, +void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b) { double p2; @@ -3219,8 +3219,8 @@ void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, +void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -3336,8 +3336,8 @@ void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -3498,8 +3498,8 @@ void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, +void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b) { double a2; @@ -3611,8 +3611,8 @@ void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, +void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b) { double a2; @@ -3740,8 +3740,8 @@ void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, +void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -3933,8 +3933,8 @@ void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, +void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b) { double p2; @@ -4140,8 +4140,8 @@ void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, +void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double a, double b) { double p2; @@ -4245,8 +4245,8 @@ void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, +void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b) { @@ -4354,8 +4354,8 @@ void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ************************************************************************/ -void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, +void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double F0, double a, double b) { @@ -4386,8 +4386,8 @@ void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double *E, ** ** @return [void] ************************************************************************/ -void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, +void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double F0, double a, double b) { @@ -4416,8 +4416,8 @@ void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double *phi, ** ** @return [void] ***************************************************************************/ -void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, - double *N,double phi0,double lambda0, +void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, + double* N,double phi0,double lambda0, double E0, double N0, double a, double b) { @@ -4498,8 +4498,8 @@ void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, ** @return [void] *************************************************************************/ -void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, +void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b) { double a2; diff --git a/gpsbabel/jeeps/gpsproj.h b/gpsbabel/jeeps/gpsproj.h index 2da86bb4e..7206b06d5 100644 --- a/gpsbabel/jeeps/gpsproj.h +++ b/gpsbabel/jeeps/gpsproj.h @@ -9,145 +9,145 @@ extern "C" #include "gps.h" - void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double phi2, + void GPS_Math_Albers_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Albers_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double phi2, + void GPS_Math_Albers_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double phi2, + void GPS_Math_LambertCC_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double phi2, + void GPS_Math_LambertCC_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double phi2, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, + void GPS_Math_Miller_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_Miller_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_Miller_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, + void GPS_Math_Bonne_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_Bonne_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, + void GPS_Math_Cassini_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_Cassini_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, + void GPS_Math_Cylea_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_Cylea_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, double N0, + void GPS_Math_EckertIV_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_EckertIV_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, double N0, + void GPS_Math_EckertVI_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_EckertVI_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, + void GPS_Math_Cyled_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_Cyled_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, + void GPS_Math_VderGrinten_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_VderGrinten_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi1, double lambda1, + void GPS_Math_PolarSt_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi1, double lambda1, double E0, double N0, double a, double b); - void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi1, double lambda1, + void GPS_Math_PolarSt_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi1, double lambda1, double E0, double N0, double a, double b); - void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, + void GPS_Math_Mollweide_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_Mollweide_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, + void GPS_Math_Orthog_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double a, double b); - void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, + void GPS_Math_Orthog_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b); - void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, + void GPS_Math_Polycon_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_Polycon_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double M0, double E0, + void GPS_Math_Sinusoid_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double M0, double E0, double N0, double a, double b); - void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double M0, double E0, + void GPS_Math_Sinusoid_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double M0, double E0, double N0, double a, double b); - void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double M0, double E0, + void GPS_Math_TCylEA_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double M0, + void GPS_Math_TCylEA_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double M0, double E0, double N0, double a, double b); - void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, + void GPS_Math_Mercator_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double a, double b); - void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, + void GPS_Math_Mercator_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b); - void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double *E, - double *N, double phi0, double lambda0, + void GPS_Math_TMerc_LatLon_To_EN(double phi, double lambda, double* E, + double* N, double phi0, double lambda0, double E0, double N0, double F0, double a, double b); - void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, + void GPS_Math_TMerc_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double F0, double a, double b); - void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double *E, - double *N,double phi0,double lambda0, + void GPS_Math_Swiss_LatLon_To_EN(double phi, double lambda, double* E, + double* N,double phi0,double lambda0, double E0, double N0, double a, double b); - void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double *phi, - double *lambda, double phi0, double lambda0, + void GPS_Math_Swiss_EN_To_LatLon(double E, double N, double* phi, + double* lambda, double phi0, double lambda0, double E0, double N0, double a, double b); #endif diff --git a/gpsbabel/jeeps/gpsprot.c b/gpsbabel/jeeps/gpsprot.c index 68d4147d9..85304bfee 100644 --- a/gpsbabel/jeeps/gpsprot.c +++ b/gpsbabel/jeeps/gpsprot.c @@ -22,7 +22,7 @@ ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ********************************************************************/ -#define COMMON +#define COMMON #include "gps.h" #include diff --git a/gpsbabel/jeeps/gpsread.c b/gpsbabel/jeeps/gpsread.c index 6fb7763b8..a2d98f672 100644 --- a/gpsbabel/jeeps/gpsread.c +++ b/gpsbabel/jeeps/gpsread.c @@ -67,18 +67,18 @@ time_t GPS_Time_Now(void) ** @return [int32] number of bytes read **********************************************************************/ -int32 GPS_Serial_Packet_Read(gpsdevh *fd, GPS_PPacket *packet) +int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) { time_t start; int32 n; int32 len; UC u; int32 isDLE; - UC *p; + UC* p; int32 i; UC chk=0, chk_read; - const char *m1; - const char *m2; + const char* m1; + const char* m2; len = 0; isDLE = gpsFalse; @@ -189,7 +189,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh *fd, GPS_PPacket *packet) ** @return [int32] true if ACK **********************************************************************/ -int32 GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec) +int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec) { if (!GPS_Serial_Packet_Read(fd, rec)) { return 0; diff --git a/gpsbabel/jeeps/gpsread.h b/gpsbabel/jeeps/gpsread.h index 781d3c53e..c9d280a1e 100644 --- a/gpsbabel/jeeps/gpsread.h +++ b/gpsbabel/jeeps/gpsread.h @@ -10,8 +10,8 @@ extern "C" #include "gps.h" time_t GPS_Time_Now(void); - int32 GPS_Serial_Packet_Read(gpsdevh *fd, GPS_PPacket *packet); - int32 GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec); + int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet); + int32 GPS_Serial_Get_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); #endif diff --git a/gpsbabel/jeeps/gpsrqst.c b/gpsbabel/jeeps/gpsrqst.c index 6947c844f..d65ce05e3 100644 --- a/gpsbabel/jeeps/gpsrqst.c +++ b/gpsbabel/jeeps/gpsrqst.c @@ -25,8 +25,8 @@ #include "gps.h" -static int32 GPS_A600_Rqst(gpsdevh *fd, time_t Time); -static int32 GPS_A700_Rqst(gpsdevh *fd, double lat, double lon); +static int32 GPS_A600_Rqst(gpsdevh* fd, time_t Time); +static int32 GPS_A700_Rqst(gpsdevh* fd, double lat, double lon); @@ -40,7 +40,7 @@ static int32 GPS_A700_Rqst(gpsdevh *fd, double lat, double lon); ** @return [int32] true if OK ************************************************************************/ -int32 GPS_Rqst_Send_Time(gpsdevh *fd, time_t Time) +int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time) { time_t ret=0; @@ -67,7 +67,7 @@ int32 GPS_Rqst_Send_Time(gpsdevh *fd, time_t Time) ** ** @return [int32] success ************************************************************************/ -static int32 GPS_A600_Rqst(gpsdevh *fd, time_t Time) +static int32 GPS_A600_Rqst(gpsdevh* fd, time_t Time) { GPS_PPacket tra; GPS_PPacket rec; @@ -112,7 +112,7 @@ static int32 GPS_A600_Rqst(gpsdevh *fd, time_t Time) ** @return [int32] success ************************************************************************/ -int32 GPS_Rqst_Send_Position(gpsdevh *fd, double lat, double lon) +int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon) { int32 ret=0; @@ -140,7 +140,7 @@ int32 GPS_Rqst_Send_Position(gpsdevh *fd, double lat, double lon) ** ** @return [int32] success ************************************************************************/ -static int32 GPS_A700_Rqst(gpsdevh *fd, double lat, double lon) +static int32 GPS_A700_Rqst(gpsdevh* fd, double lat, double lon) { GPS_PPacket tra; GPS_PPacket rec; diff --git a/gpsbabel/jeeps/gpsrqst.h b/gpsbabel/jeeps/gpsrqst.h index f2606d938..0afd29f58 100644 --- a/gpsbabel/jeeps/gpsrqst.h +++ b/gpsbabel/jeeps/gpsrqst.h @@ -9,8 +9,8 @@ extern "C" #include "gps.h" - int32 GPS_Rqst_Send_Time(gpsdevh *fd, time_t Time); - int32 GPS_Rqst_Send_Position(gpsdevh *fd, double lat, double lon); + int32 GPS_Rqst_Send_Time(gpsdevh* fd, time_t Time); + int32 GPS_Rqst_Send_Position(gpsdevh* fd, double lat, double lon); #endif diff --git a/gpsbabel/jeeps/gpssend.c b/gpsbabel/jeeps/gpssend.c index d757c5a2c..cd5d68a47 100644 --- a/gpsbabel/jeeps/gpssend.c +++ b/gpsbabel/jeeps/gpssend.c @@ -42,8 +42,8 @@ static US Build_Serial_Packet(GPS_PPacket in, GPS_Serial_PPacket out) { - UC *p; - UC *q; + UC* p; + UC* q; int32 i; UC chk=0; @@ -89,18 +89,18 @@ Build_Serial_Packet(GPS_PPacket in, GPS_Serial_PPacket out) void -Diag(void *buf, size_t sz) +Diag(void* buf, size_t sz) { - unsigned char *cbuf = (unsigned char *) buf; + unsigned char* cbuf = (unsigned char*) buf; while (sz--) { GPS_Diag("%02x ", *cbuf++); } } void -DiagS(void *buf, size_t sz) +DiagS(void* buf, size_t sz) { - unsigned char *cbuf = (unsigned char *) buf; + unsigned char* cbuf = (unsigned char*) buf; while (sz--) { unsigned char c = *cbuf++; @@ -118,10 +118,10 @@ DiagS(void *buf, size_t sz) ** @return [int32] number of bytes in the packet ************************************************************************/ -int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet) +int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet) { size_t ret; - const char *m1, *m2; + const char* m1, *m2; GPS_Serial_OPacket ser_pkt; UC ser_pkt_data[MAX_GPS_PACKET_SIZE * sizeof(UC)]; US bytes; @@ -136,7 +136,7 @@ int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet) GPS_Diag("Tx Data:"); Diag(&ser_pkt.dle, 3); - if ((ret=GPS_Serial_Write(fd,(const void *) &ser_pkt.dle,(size_t)3)) == -1) { + if ((ret=GPS_Serial_Write(fd,(const void*) &ser_pkt.dle,(size_t)3)) == -1) { perror("write"); GPS_Error("SEND: Write to GPS failed"); return 0; @@ -147,7 +147,7 @@ int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet) } Diag(ser_pkt.data, bytes); - if ((ret=GPS_Serial_Write(fd,(const void *)ser_pkt.data,(size_t)bytes)) == -1) { + if ((ret=GPS_Serial_Write(fd,(const void*)ser_pkt.data,(size_t)bytes)) == -1) { perror("write"); GPS_Error("SEND: Write to GPS failed"); return 0; @@ -166,7 +166,7 @@ int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet) m1 = Get_Pkt_Type(ser_pkt.type, ser_pkt.data[0], &m2); GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : ""); - if ((ret=GPS_Serial_Write(fd,(const void *)&ser_pkt.chk,(size_t)3)) == -1) { + if ((ret=GPS_Serial_Write(fd,(const void*)&ser_pkt.chk,(size_t)3)) == -1) { perror("write"); GPS_Error("SEND: Write to GPS failed"); return 0; @@ -192,7 +192,7 @@ int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet) ** @return [int32] success ************************************************************************/ -int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec) +int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec) { UC data[2]; diff --git a/gpsbabel/jeeps/gpssend.h b/gpsbabel/jeeps/gpssend.h index 5276a14fa..68b480291 100644 --- a/gpsbabel/jeeps/gpssend.h +++ b/gpsbabel/jeeps/gpssend.h @@ -11,10 +11,10 @@ extern "C" #define GPS_ARB_LEN 1024 - int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet); - int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec); + int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet); + int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); - void GPS_Make_Packet(GPS_PPacket *packet, US type, UC *data, uint32 n); + void GPS_Make_Packet(GPS_PPacket* packet, US type, UC* data, uint32 n); #endif diff --git a/gpsbabel/jeeps/gpsserial.c b/gpsbabel/jeeps/gpsserial.c index 750a410ba..8afd4eb09 100644 --- a/gpsbabel/jeeps/gpsserial.c +++ b/gpsbabel/jeeps/gpsserial.c @@ -35,7 +35,7 @@ #if 0 #define GARMULATOR 1 -char *rxdata[] = { +char* rxdata[] = { "10 06 02 fe 00 fa 10 03", "10 ff 7d 97 00 0e 01 53 74 72 65 65 74 50 69 6c 6f 74 20 33 20 53 6f 66 74 77 61 72 65 20 56 65 72 73 69 6f 6e 20 32 2e 37 30 00 56 45 52 42 4d 41 50 20 41 6d 65 72 69 63 61 73 20 41 75 74 6f 72 6f 75 74 65 20 31 2e 30 30 00 56 45 52 41 55 44 20 45 6e 67 6c 69 73 68 20 33 2e 30 31 00 56 45 52 53 50 4c 53 43 52 4e 20 53 70 6c 61 73 68 20 53 63 72 65 65 6e 20 4d 69 73 73 69 6e 67 00 f1 10 03", "10 f8 0e 56 45 52 53 4d 41 50 31 20 4e 6f 6e 65 00 fb 10 03", @@ -66,11 +66,11 @@ typedef struct { /* * Display an error from the serial subsystem. */ -void GPS_Serial_Error(const char *mb, ...) +void GPS_Serial_Error(const char* mb, ...) { va_list ap; char msg[200]; - char *s; + char* s; int b; va_start(ap, mb); @@ -84,13 +84,13 @@ void GPS_Serial_Error(const char *mb, ...) GPS_Error(msg); } -int32 GPS_Serial_On(const char *port, gpsdevh **dh) +int32 GPS_Serial_On(const char* port, gpsdevh** dh) { DCB tio; COMMTIMEOUTS timeout; HANDLE comport; - const char *xname = fix_win_serial_name(port); - win_serial_data *wsd = xcalloc(sizeof(win_serial_data), 1); + const char* xname = fix_win_serial_name(port); + win_serial_data* wsd = xcalloc(sizeof(win_serial_data), 1); *dh = (gpsdevh*) wsd; GPS_Diag("Opening %s\n", xname); comport = CreateFileA(xname, GENERIC_READ|GENERIC_WRITE, 0, NULL, @@ -154,26 +154,26 @@ int32 GPS_Serial_On(const char *port, gpsdevh **dh) return 1; } -int32 GPS_Serial_Off(gpsdevh *dh) +int32 GPS_Serial_Off(gpsdevh* dh) { - win_serial_data *wsd = (win_serial_data*)dh; + win_serial_data* wsd = (win_serial_data*)dh; CloseHandle(wsd->comport); wsd->comport = INVALID_HANDLE_VALUE; xfree(wsd); return 1; } -int32 GPS_Serial_Chars_Ready(gpsdevh *dh) +int32 GPS_Serial_Chars_Ready(gpsdevh* dh) { COMSTAT lpStat; DWORD lpErrors; - win_serial_data *wsd = (win_serial_data*)dh; + win_serial_data* wsd = (win_serial_data*)dh; ClearCommError(wsd->comport, &lpErrors, &lpStat); return (lpStat.cbInQue > 0); } -int32 GPS_Serial_Wait(gpsdevh *fd) +int32 GPS_Serial_Wait(gpsdevh* fd) { /* Wait a short time before testing if data is ready. * The GPS II, in particular, has a noticable time responding @@ -186,14 +186,14 @@ int32 GPS_Serial_Wait(gpsdevh *fd) return GPS_Serial_Chars_Ready(fd); } -int32 GPS_Serial_Flush(gpsdevh *fd) +int32 GPS_Serial_Flush(gpsdevh* fd) { return 1; } -int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size) +int32 GPS_Serial_Write(gpsdevh* dh, const void* obuf, int size) { - win_serial_data *wsd = (win_serial_data*)dh; + win_serial_data* wsd = (win_serial_data*)dh; DWORD len; /* @@ -213,10 +213,10 @@ int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size) return len; } -int32 GPS_Serial_Read(gpsdevh * dh, void *ibuf, int size) +int32 GPS_Serial_Read(gpsdevh* dh, void* ibuf, int size) { DWORD cnt = 0; - win_serial_data *wsd = (win_serial_data*)dh; + win_serial_data* wsd = (win_serial_data*)dh; ReadFile(wsd->comport, ibuf, size, &cnt, NULL); return cnt; @@ -244,10 +244,10 @@ typedef struct { ** @return [int32] false upon error ************************************************************************/ -int32 GPS_Serial_Open(gpsdevh *dh, const char *port) +int32 GPS_Serial_Open(gpsdevh* dh, const char* port) { struct termios tty; - posix_serial_data *psd = (posix_serial_data *)dh; + posix_serial_data* psd = (posix_serial_data*)dh; /* * This originally had O_NDELAY | O_NOCTTY in here, but this @@ -290,11 +290,11 @@ int32 GPS_Serial_Open(gpsdevh *dh, const char *port) /* * Display an error from the serial subsystem. */ -void GPS_Serial_Error(const char *mb, ...) +void GPS_Serial_Error(const char* mb, ...) { va_list ap; char msg[200]; - char *s; + char* s; int b; va_start(ap, mb); @@ -310,16 +310,16 @@ void GPS_Serial_Error(const char *mb, ...) GPS_Error(msg); } -int32 GPS_Serial_Read(gpsdevh *dh, void *ibuf, int size) +int32 GPS_Serial_Read(gpsdevh* dh, void* ibuf, int size) { - posix_serial_data *psd = (posix_serial_data *)dh; + posix_serial_data* psd = (posix_serial_data*)dh; #if GARMULATOR static int l; - static char *rp; - char **rxp = &rxdata[l]; - char *hex; - char *rx = *rxp; - char *ib = ibuf; + static char* rp; + char** rxp = &rxdata[l]; + char* hex; + char* rx = *rxp; + char* ib = ibuf; if (!rp) { rp = rxdata[0]; @@ -342,9 +342,9 @@ int32 GPS_Serial_Read(gpsdevh *dh, void *ibuf, int size) #endif } -int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size) +int32 GPS_Serial_Write(gpsdevh* dh, const void* obuf, int size) { - posix_serial_data *psd = (posix_serial_data *)dh; + posix_serial_data* psd = (posix_serial_data*)dh; return write(psd->fd, obuf, size); } @@ -357,9 +357,9 @@ int32 GPS_Serial_Write(gpsdevh *dh, const void *obuf, int size) ** ** @return [int32] false upon error ************************************************************************/ -int32 GPS_Serial_Flush(gpsdevh *fd) +int32 GPS_Serial_Flush(gpsdevh* fd) { - posix_serial_data *psd = (posix_serial_data *)fd; + posix_serial_data* psd = (posix_serial_data*)fd; if (tcflush(psd->fd,TCIOFLUSH)) { GPS_Serial_Error("SERIAL: tcflush error"); @@ -382,9 +382,9 @@ int32 GPS_Serial_Flush(gpsdevh *fd) ** @return [int32] false upon error ************************************************************************/ -int32 GPS_Serial_Close(gpsdevh *fd) +int32 GPS_Serial_Close(gpsdevh* fd) { - posix_serial_data *psd = (posix_serial_data *)fd; + posix_serial_data* psd = (posix_serial_data*)fd; if (tcsetattr(psd->fd, TCSAFLUSH, &psd->gps_ttysave)==-1) { gps_errno = HARDWARE_ERROR; @@ -411,11 +411,11 @@ int32 GPS_Serial_Close(gpsdevh *fd) ** @return [int32] true if chars waiting ************************************************************************/ -int32 GPS_Serial_Chars_Ready(gpsdevh *dh) +int32 GPS_Serial_Chars_Ready(gpsdevh* dh) { fd_set rec; struct timeval t; - posix_serial_data *psd = (posix_serial_data *)dh; + posix_serial_data* psd = (posix_serial_data*)dh; int32 fd = psd->fd; #if GARMULATOR @@ -454,11 +454,11 @@ int32 GPS_Serial_Chars_Ready(gpsdevh *dh) ** @return [int32] true if serial chars waiting ************************************************************************/ -int32 GPS_Serial_Wait(gpsdevh *dh) +int32 GPS_Serial_Wait(gpsdevh* dh) { fd_set rec; struct timeval t; - posix_serial_data *psd = (posix_serial_data *)dh; + posix_serial_data* psd = (posix_serial_data*)dh; FD_ZERO(&rec); FD_SET(psd->fd,&rec); @@ -486,12 +486,12 @@ int32 GPS_Serial_Wait(gpsdevh *dh) ** @return [int32] success ************************************************************************/ -int32 GPS_Serial_On(const char *port, gpsdevh **dh) +int32 GPS_Serial_On(const char* port, gpsdevh** dh) { - posix_serial_data *psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1); + posix_serial_data* psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1); *dh = (gpsdevh*) psd; - if (!GPS_Serial_Open((gpsdevh *) psd,port)) { + if (!GPS_Serial_Open((gpsdevh*) psd,port)) { GPS_Error("Cannot open serial port '%s'", port); gps_errno = SERIAL_ERROR; return 0; @@ -512,7 +512,7 @@ int32 GPS_Serial_On(const char *port, gpsdevh **dh) ** @return [int32] success ************************************************************************/ -int32 GPS_Serial_Off(gpsdevh *dh) +int32 GPS_Serial_Off(gpsdevh* dh) { if (!GPS_Serial_Close(dh)) { diff --git a/gpsbabel/jeeps/gpsserial.h b/gpsbabel/jeeps/gpsserial.h index cb29d66a2..1ebda4703 100644 --- a/gpsbabel/jeeps/gpsserial.h +++ b/gpsbabel/jeeps/gpsserial.h @@ -11,22 +11,22 @@ extern "C" #define usecDELAY 180000 /* Microseconds before GPS sends A001 */ - int32 GPS_Serial_Chars_Ready(gpsdevh * fd); + int32 GPS_Serial_Chars_Ready(gpsdevh* fd); // int32 GPS_Serial_Close(int32 fd, const char *port); // int32 GPS_Serial_Open(int32 *fd, const char *port); // int32 GPS_Serial_Open_NMEA(int32 *fd, const char *port); // int32 GPS_Serial_Restoretty(const char *port); // int32 GPS_Serial_Savetty(const char *port); - int32 GPS_Serial_On(const char *port, gpsdevh **fd); - int32 GPS_Serial_Off(gpsdevh *fd); - int32 GPS_Serial_Wait(gpsdevh *fd); - int32 GPS_Serial_Flush(gpsdevh *fd); + int32 GPS_Serial_On(const char* port, gpsdevh** fd); + int32 GPS_Serial_Off(gpsdevh* fd); + int32 GPS_Serial_Wait(gpsdevh* fd); + int32 GPS_Serial_Flush(gpsdevh* fd); // int32 GPS_Serial_On_NMEA(const char *port, gpsdevh **fd); - int32 GPS_Serial_Read(gpsdevh *fd, void *ibuf, int size); - int32 GPS_Serial_Write(gpsdevh *fd, const void *obuf, int size); - int32 GPS_Serial_Write_Packet(gpsdevh *fd, GPS_PPacket packet); - int32 GPS_Serial_Send_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec); - void GPS_Serial_Error(const char *hdr, ...); + int32 GPS_Serial_Read(gpsdevh* fd, void* ibuf, int size); + int32 GPS_Serial_Write(gpsdevh* fd, const void* obuf, int size); + int32 GPS_Serial_Write_Packet(gpsdevh* fd, GPS_PPacket packet); + int32 GPS_Serial_Send_Ack(gpsdevh* fd, GPS_PPacket* tra, GPS_PPacket* rec); + void GPS_Serial_Error(const char* hdr, ...); #endif diff --git a/gpsbabel/jeeps/gpsusbcommon.c b/gpsbabel/jeeps/gpsusbcommon.c index 3d37bcfc1..fb3ae7306 100644 --- a/gpsbabel/jeeps/gpsusbcommon.c +++ b/gpsbabel/jeeps/gpsusbcommon.c @@ -34,20 +34,20 @@ enum { rs_frombulk } receive_state; -static gusb_llops_t *gusb_llops; +static gusb_llops_t* gusb_llops; /* Decide when to truncate packets for debug output */ #define DEBUG_THRESH ((global_opts.debug_level < 5) && (i > 10)) /* Called from OS layer to register its low-level entry points. */ void -gusb_register_ll(gusb_llops_t *p) +gusb_register_ll(gusb_llops_t* p) { gusb_llops = p; } int -gusb_close(gpsdevh *dh) +gusb_close(gpsdevh* dh) { garmin_usb_packet scratch; @@ -79,10 +79,10 @@ gusb_close(gpsdevh *dh) int -gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz) +gusb_cmd_get(garmin_usb_packet* ibuf, size_t sz) { int rv; - unsigned char *buf = (unsigned char *) &ibuf->dbuf; + unsigned char* buf = (unsigned char*) &ibuf->dbuf; int orig_receive_state; unsigned short pkt_id; top: @@ -101,7 +101,7 @@ top: pkt_id = le_read16(&ibuf->gusb_pkt.pkt_id); if (gps_show_bytes) { int i; - const char *m1, *m2; + const char* m1, *m2; unsigned short pkttype = le_read16(&ibuf->gusb_pkt.databuf[0]); GPS_Diag("RX (%s) [%d]:", @@ -152,12 +152,12 @@ top: } int -gusb_cmd_send(const garmin_usb_packet *opkt, size_t sz) +gusb_cmd_send(const garmin_usb_packet* opkt, size_t sz) { unsigned int rv, i; - unsigned char *obuf = (unsigned char *) &opkt->dbuf; - const char *m1, *m2; + unsigned char* obuf = (unsigned char*) &opkt->dbuf; + const char* m1, *m2; rv = gusb_llops->llop_send(opkt, sz); @@ -210,14 +210,14 @@ gusb_list_units() } void -gusb_id_unit(garmin_unit_info_t *gu) +gusb_id_unit(garmin_unit_info_t* gu) { static const char oid[12] = {20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0}; garmin_usb_packet iresp; int i; - gusb_cmd_send((garmin_usb_packet *)oid, sizeof(oid)); + gusb_cmd_send((garmin_usb_packet*)oid, sizeof(oid)); for (i = 0; i < 25; i++) { iresp.gusb_pkt.type = 0; @@ -225,7 +225,7 @@ gusb_id_unit(garmin_unit_info_t *gu) return; } if (le_read16(iresp.gusb_pkt.pkt_id) == 0xff) { - gu->product_identifier = xstrdup((char *) iresp.gusb_pkt.databuf+4); + gu->product_identifier = xstrdup((char*) iresp.gusb_pkt.databuf+4); gu->unit_id = le_read16(iresp.gusb_pkt.databuf+0); gu->unit_version = le_read16(iresp.gusb_pkt.databuf+2); } @@ -260,7 +260,7 @@ gusb_syncup(void) le_write32(&iresp.gusb_pkt.datasz, 0); le_write32(&iresp.gusb_pkt.databuf, 0); - gusb_cmd_send((const garmin_usb_packet *) oinit, sizeof(oinit)); + gusb_cmd_send((const garmin_usb_packet*) oinit, sizeof(oinit)); gusb_cmd_get(&iresp, sizeof(iresp)); if ((le_read16(iresp.gusb_pkt.pkt_id) == GUSB_SESSION_ACK) && diff --git a/gpsbabel/jeeps/gpsusbcommon.h b/gpsbabel/jeeps/gpsusbcommon.h index 323c843e6..94d71f4e9 100644 --- a/gpsbabel/jeeps/gpsusbcommon.h +++ b/gpsbabel/jeeps/gpsusbcommon.h @@ -23,9 +23,9 @@ * The 'low level ops' are registered by the OS layer (win32, libusb, etc.) * to provide gruntwork features for the common USB layer. */ -typedef int (*gusb_llop_get)(garmin_usb_packet *ibuf, size_t sz); -typedef int (*gusb_llop_send)(const garmin_usb_packet *opkt, size_t sz); -typedef int (*gusb_llop_close)(gpsdevh *dh); +typedef int (*gusb_llop_get)(garmin_usb_packet* ibuf, size_t sz); +typedef int (*gusb_llop_send)(const garmin_usb_packet* opkt, size_t sz); +typedef int (*gusb_llop_close)(gpsdevh* dh); typedef struct gusb_llops { gusb_llop_get llop_get_intr; @@ -37,7 +37,7 @@ typedef struct gusb_llops { /* Provided by the common code. */ void gusb_syncup(void); -void gusb_register_ll(struct gusb_llops *); +void gusb_register_ll(struct gusb_llops*); void gusb_list_units(void); /* Provided by the OS layers */ diff --git a/gpsbabel/jeeps/gpsusbint.h b/gpsbabel/jeeps/gpsusbint.h index 8d91da24a..5386d7c06 100644 --- a/gpsbabel/jeeps/gpsusbint.h +++ b/gpsbabel/jeeps/gpsusbint.h @@ -21,7 +21,7 @@ */ -int32 GPS_Packet_Read_usb(gpsdevh *fd, GPS_PPacket *packet, int eatbulk); -void GPS_Make_Packet_usb(GPS_PPacket *packet, UC type, UC *data, int16 n); -int32 GPS_Write_Packet_usb(gpsdevh *fd, GPS_PPacket packet); +int32 GPS_Packet_Read_usb(gpsdevh* fd, GPS_PPacket* packet, int eatbulk); +void GPS_Make_Packet_usb(GPS_PPacket* packet, UC type, UC* data, int16 n); +int32 GPS_Write_Packet_usb(gpsdevh* fd, GPS_PPacket packet); diff --git a/gpsbabel/jeeps/gpsusbread.c b/gpsbabel/jeeps/gpsusbread.c index 363d5d2f2..7fb20386c 100644 --- a/gpsbabel/jeeps/gpsusbread.c +++ b/gpsbabel/jeeps/gpsusbread.c @@ -28,7 +28,7 @@ * Negative on error. * 1 if read success - even if empty packet. */ -int32 GPS_Packet_Read_usb(gpsdevh *dh, GPS_PPacket *packet, int eat_bulk) +int32 GPS_Packet_Read_usb(gpsdevh* dh, GPS_PPacket* packet, int eat_bulk) { int32 n; int32 payload_size; diff --git a/gpsbabel/jeeps/gpsusbsend.c b/gpsbabel/jeeps/gpsusbsend.c index cacb3c54d..420445f4d 100644 --- a/gpsbabel/jeeps/gpsusbsend.c +++ b/gpsbabel/jeeps/gpsusbsend.c @@ -26,7 +26,7 @@ #include "gpsusbint.h" int32 -GPS_Write_Packet_usb(gpsdevh *dh, GPS_PPacket packet) +GPS_Write_Packet_usb(gpsdevh* dh, GPS_PPacket packet) { garmin_usb_packet gp; memset(&gp, 0, sizeof(gp)); diff --git a/gpsbabel/jeeps/gpsusbstub.c b/gpsbabel/jeeps/gpsusbstub.c index 5d80e7fec..bf4fe7cf8 100644 --- a/gpsbabel/jeeps/gpsusbstub.c +++ b/gpsbabel/jeeps/gpsusbstub.c @@ -31,7 +31,7 @@ const char no_usb[] = "USB support is not available in this build.\n"; int -gusb_init(const char *portname) +gusb_init(const char* portname) { fatal(no_usb); return 0; diff --git a/gpsbabel/jeeps/gpsusbwin.c b/gpsbabel/jeeps/gpsusbwin.c index dd6bea2bf..c95918b15 100644 --- a/gpsbabel/jeeps/gpsusbwin.c +++ b/gpsbabel/jeeps/gpsusbwin.c @@ -53,12 +53,12 @@ typedef struct { int booger; } winusb_unit_data; -static HANDLE *usb_handle = INVALID_HANDLE_VALUE; +static HANDLE* usb_handle = INVALID_HANDLE_VALUE; static int usb_tx_packet_size ; -static const gdx_info *gdx; +static const gdx_info* gdx; static int -gusb_win_close(gpsdevh *handle) +gusb_win_close(gpsdevh* handle) { if (usb_handle != INVALID_HANDLE_VALUE) { CloseHandle(usb_handle); @@ -69,10 +69,10 @@ gusb_win_close(gpsdevh *handle) } static int -gusb_win_get(garmin_usb_packet *ibuf, size_t sz) +gusb_win_get(garmin_usb_packet* ibuf, size_t sz) { DWORD rxed = GARMIN_USB_INTERRUPT_DATA_SIZE; - unsigned char *buf = (unsigned char *) &ibuf->dbuf; + unsigned char* buf = (unsigned char*) &ibuf->dbuf; int tsz=0; while (sz) { @@ -95,11 +95,11 @@ gusb_win_get(garmin_usb_packet *ibuf, size_t sz) } static int -gusb_win_get_bulk(garmin_usb_packet *ibuf, size_t sz) +gusb_win_get_bulk(garmin_usb_packet* ibuf, size_t sz) { int n; DWORD rsz; - unsigned char *buf = (unsigned char *) &ibuf->dbuf; + unsigned char* buf = (unsigned char*) &ibuf->dbuf; n = ReadFile(usb_handle, buf, sz, &rsz, NULL); @@ -107,10 +107,10 @@ gusb_win_get_bulk(garmin_usb_packet *ibuf, size_t sz) } static int -gusb_win_send(const garmin_usb_packet *opkt, size_t sz) +gusb_win_send(const garmin_usb_packet* opkt, size_t sz) { DWORD rsz; - unsigned char *obuf = (unsigned char *) &opkt->dbuf; + unsigned char* obuf = (unsigned char*) &opkt->dbuf; /* The spec warns us about making writes an exact multiple * of the packet size, but isn't clear whether we can issue @@ -133,7 +133,7 @@ static gusb_llops_t win_llops = { }; static -HANDLE * garmin_usb_start(HDEVINFO* hdevinfo, SP_DEVICE_INTERFACE_DATA *infodata) +HANDLE* garmin_usb_start(HDEVINFO* hdevinfo, SP_DEVICE_INTERFACE_DATA* infodata) { DWORD size; PSP_INTERFACE_DEVICE_DETAIL_DATA pdd = NULL; @@ -185,12 +185,12 @@ HANDLE * garmin_usb_start(HDEVINFO* hdevinfo, SP_DEVICE_INTERFACE_DATA *infodata } -static char ** get_garmin_mountpoints(void) +static char** get_garmin_mountpoints(void) { #define BUFSIZE 512 TCHAR szTemp[MAX_PATH]; - char *p = szTemp; - char **dlist = xmalloc(sizeof(*dlist)); + char* p = szTemp; + char** dlist = xmalloc(sizeof(*dlist)); int i = 0; dlist[0] = NULL; @@ -213,7 +213,7 @@ static char ** get_garmin_mountpoints(void) * device, and light it up. */ int -gusb_init(const char *pname, gpsdevh **dh) +gusb_init(const char* pname, gpsdevh** dh) { int req_unit_number = 0; int un = 0; @@ -222,7 +222,7 @@ gusb_init(const char *pname, gpsdevh **dh) HDEVINFO hdevinfo; SP_DEVICE_INTERFACE_DATA devinterface; - winusb_unit_data *wud = xcalloc(sizeof(winusb_unit_data), 1); + winusb_unit_data* wud = xcalloc(sizeof(winusb_unit_data), 1); *dh = (gpsdevh*) wud; gusb_register_ll(&win_llops); @@ -235,7 +235,7 @@ gusb_init(const char *pname, gpsdevh **dh) } } - hdevinfo = SetupDiGetClassDevs((GUID *) &GARMIN_GUID, NULL, NULL, + hdevinfo = SetupDiGetClassDevs((GUID*) &GARMIN_GUID, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); if (hdevinfo == INVALID_HANDLE_VALUE) { @@ -248,12 +248,12 @@ gusb_init(const char *pname, gpsdevh **dh) if (req_unit_number >= 0) { if (!SetupDiEnumDeviceInterfaces(hdevinfo, NULL, - (GUID *) &GARMIN_GUID, + (GUID*) &GARMIN_GUID, req_unit_number, &devinterface)) { // If there were zero matches, we may be trying to talk to a "GPX Mode" device. - char **dlist = get_garmin_mountpoints(); + char** dlist = get_garmin_mountpoints(); gdx = gdx_find_file(dlist); if (gdx) { return 1; @@ -276,7 +276,7 @@ gusb_init(const char *pname, gpsdevh **dh) */ for (match = 0;; match++) { if (!SetupDiEnumDeviceInterfaces(hdevinfo, NULL, - (GUID *) &GARMIN_GUID, match, &devinterface)) { + (GUID*) &GARMIN_GUID, match, &devinterface)) { if (GetLastError() == ERROR_NO_MORE_ITEMS) { break; diff --git a/gpsbabel/jeeps/gpsutil.c b/gpsbabel/jeeps/gpsutil.c index fa962ea81..8a6201b7e 100644 --- a/gpsbabel/jeeps/gpsutil.c +++ b/gpsbabel/jeeps/gpsutil.c @@ -72,12 +72,12 @@ int32 GPS_Util_Little(void) ** @return [US] value ************************************************************************/ -US GPS_Util_Get_Short(const UC *s) +US GPS_Util_Get_Short(const UC* s) { static US ret; - UC *p; + UC* p; - p = (UC *)&ret; + p = (UC*)&ret; if (!GPS_Little) { *p++ = *(s+1); @@ -102,11 +102,11 @@ US GPS_Util_Get_Short(const UC *s) ** @return [void] ************************************************************************/ -void GPS_Util_Put_Short(UC *s, const US v) +void GPS_Util_Put_Short(UC* s, const US v) { - UC *p; + UC* p; - p = (UC *)&v; + p = (UC*)&v; if (!GPS_Little) { *s++ = *(p+1); @@ -128,13 +128,13 @@ void GPS_Util_Put_Short(UC *s, const US v) ** @return [double] value ************************************************************************/ -double GPS_Util_Get_Double(const UC *s) +double GPS_Util_Get_Double(const UC* s) { double ret; - UC *p; + UC* p; int32 i; - p = (UC *)&ret; + p = (UC*)&ret; if (!GPS_Little) @@ -161,12 +161,12 @@ double GPS_Util_Get_Double(const UC *s) ** @return [void] ************************************************************************/ -void GPS_Util_Put_Double(UC *s, const double v) +void GPS_Util_Put_Double(UC* s, const double v) { - UC *p; + UC* p; int32 i; - p = (UC *)&v; + p = (UC*)&v; if (!GPS_Little) for (i=sizeof(double)-1; i>-1; --i) { @@ -190,13 +190,13 @@ void GPS_Util_Put_Double(UC *s, const double v) ** @return [int32] value ************************************************************************/ -int32 GPS_Util_Get_Int(const UC *s) +int32 GPS_Util_Get_Int(const UC* s) { int32 ret; - UC *p; + UC* p; int32 i; - p = (UC *)&ret; + p = (UC*)&ret; if (!GPS_Little) @@ -223,12 +223,12 @@ int32 GPS_Util_Get_Int(const UC *s) ** @return [void] ************************************************************************/ -void GPS_Util_Put_Int(UC *s, const int32 v) +void GPS_Util_Put_Int(UC* s, const int32 v) { - UC *p; + UC* p; int32 i; - p = (UC *)&v; + p = (UC*)&v; if (!GPS_Little) for (i=sizeof(int32)-1; i>-1; --i) { @@ -251,13 +251,13 @@ void GPS_Util_Put_Int(UC *s, const int32 v) ** @return [uint32] value ************************************************************************/ -uint32 GPS_Util_Get_Uint(const UC *s) +uint32 GPS_Util_Get_Uint(const UC* s) { uint32 ret; - UC *p; + UC* p; int32 i; - p = (UC *)&ret; + p = (UC*)&ret; if (!GPS_Little) @@ -284,12 +284,12 @@ uint32 GPS_Util_Get_Uint(const UC *s) ** @return [void] ************************************************************************/ -void GPS_Util_Put_Uint(UC *s, const uint32 v) +void GPS_Util_Put_Uint(UC* s, const uint32 v) { - UC *p; + UC* p; int32 i; - p = (UC *)&v; + p = (UC*)&v; if (!GPS_Little) for (i=sizeof(uint32)-1; i>-1; --i) { @@ -312,13 +312,13 @@ void GPS_Util_Put_Uint(UC *s, const uint32 v) ** @return [float] value ************************************************************************/ -float GPS_Util_Get_Float(const UC *s) +float GPS_Util_Get_Float(const UC* s) { float ret; - UC *p; + UC* p; int32 i; - p = (UC *)&ret; + p = (UC*)&ret; if (!GPS_Little) @@ -345,12 +345,12 @@ float GPS_Util_Get_Float(const UC *s) ** @return [void] ************************************************************************/ -void GPS_Util_Put_Float(UC *s, const float v) +void GPS_Util_Put_Float(UC* s, const float v) { - UC *p; + UC* p; int32 i; - p = (UC *)&v; + p = (UC*)&v; if (!GPS_Little) for (i=sizeof(float)-1; i>-1; --i) { @@ -457,7 +457,7 @@ int32 GPS_Util_Block(int32 fd, int32 state) ** @@ ****************************************************************************/ -void GPS_Warning(char *s) +void GPS_Warning(char* s) { if (!gps_warning) { return; @@ -481,7 +481,7 @@ void GPS_Warning(char *s) ** @@ ****************************************************************************/ -void GPS_Fatal(char *s) +void GPS_Fatal(char* s) { fprintf(stderr,"[FATAL] %s\n",s); @@ -501,7 +501,7 @@ void GPS_Fatal(char *s) ** @@ ****************************************************************************/ -void GPS_Error(char *fmt, ...) +void GPS_Error(char* fmt, ...) { va_list argp; va_start(argp, fmt); @@ -594,7 +594,7 @@ void GPS_Disable_Warning(void) ** @@ ****************************************************************************/ -void GPS_User(const char *fmt, ...) +void GPS_User(const char* fmt, ...) { va_list argp; va_start(argp, fmt); @@ -659,7 +659,7 @@ void GPS_Diagnose(int32 c) return; } -void GPS_Diag(const char *fmt, ...) +void GPS_Diag(const char* fmt, ...) { va_list argp; va_start(argp, fmt); diff --git a/gpsbabel/jeeps/gpsutil.h b/gpsbabel/jeeps/gpsutil.h index d9469b264..625176659 100644 --- a/gpsbabel/jeeps/gpsutil.h +++ b/gpsbabel/jeeps/gpsutil.h @@ -11,32 +11,32 @@ extern "C" int32 GPS_Util_Little(void); - US GPS_Util_Get_Short(const UC *s); - void GPS_Util_Put_Short(UC *s, const US v); - int32 GPS_Util_Get_Int(const UC *s); - void GPS_Util_Put_Int(UC *s, const int32 v); - double GPS_Util_Get_Double(const UC *s); - void GPS_Util_Put_Double(UC *s, const double v); - float GPS_Util_Get_Float(const UC *s); - void GPS_Util_Put_Float(UC *s, const float v); + US GPS_Util_Get_Short(const UC* s); + void GPS_Util_Put_Short(UC* s, const US v); + int32 GPS_Util_Get_Int(const UC* s); + void GPS_Util_Put_Int(UC* s, const int32 v); + double GPS_Util_Get_Double(const UC* s); + void GPS_Util_Put_Double(UC* s, const double v); + float GPS_Util_Get_Float(const UC* s); + void GPS_Util_Put_Float(UC* s, const float v); void GPS_Util_Canon(int32 state); int32 GPS_Util_Block(int32 fd, int32 state); - void GPS_Util_Put_Uint(UC *s, const uint32 v); - uint32 GPS_Util_Get_Uint(const UC *s); + void GPS_Util_Put_Uint(UC* s, const uint32 v); + uint32 GPS_Util_Get_Uint(const UC* s); - void GPS_Warning(char *s); - void GPS_Error(char *fmt, ...); - void GPS_Serial_Error(const char *hdr, ...); - void GPS_Fatal(char *s); + void GPS_Warning(char* s); + void GPS_Error(char* fmt, ...); + void GPS_Serial_Error(const char* hdr, ...); + void GPS_Fatal(char* s); void GPS_Enable_Error(void); void GPS_Enable_Warning(void); void GPS_Disable_Error(void); void GPS_Disable_Warning(void); - void GPS_User(const char *fmt, ...); + void GPS_User(const char* fmt, ...); void GPS_Disable_User(void); void GPS_Enable_User(void); void GPS_Diagnose(int32 c); - void GPS_Diag(const char *fmt, ...); + void GPS_Diag(const char* fmt, ...); void GPS_Enable_Diagnose(void); void GPS_Disable_Diagnose(void); diff --git a/gpsbabel/jeeps/main.c b/gpsbabel/jeeps/main.c index 263b2fbbb..128cbd2b7 100644 --- a/gpsbabel/jeeps/main.c +++ b/gpsbabel/jeeps/main.c @@ -4,8 +4,8 @@ main() { int n; - GPS_PWay *way; - GPS_PWay *array; + GPS_PWay* way; + GPS_PWay* array; if (GPS_Init("/dev/ttyS0") < 0) { fprintf(stderr, "Can't init\n"); @@ -19,7 +19,7 @@ main() GPS_Fmt_Print_Waypoint(way, n, stdout); - array = (GPS_PWay *) calloc(1, sizeof(GPS_PWay)); + array = (GPS_PWay*) calloc(1, sizeof(GPS_PWay)); array[0] = GPS_Way_New(); strcpy(array[0]->ident,"lower @#$%^&* rocks"); strcpy(array[0]->cmnt,"COMMENTCOMMENTCOMMENTCOMMENTCOMMENT"); diff --git a/gpsbabel/jogmap.c b/gpsbabel/jogmap.c index 48407d1bb..62c65085e 100644 --- a/gpsbabel/jogmap.c +++ b/gpsbabel/jogmap.c @@ -25,7 +25,7 @@ #include "jeeps/gpsmath.h" #include "garmin_tables.h" -static route_head *trk; +static route_head* trk; static arglist_t jogmap_args[] = { ARG_TERMINATOR @@ -35,7 +35,7 @@ static arglist_t jogmap_args[] = { #if ! HAVE_LIBEXPAT void -jogmap_rd_init(const char *fname) +jogmap_rd_init(const char* fname) { fatal(MYNAME ": This build excluded \"" MYNAME "\" support because expat was not installed.\n"); } @@ -55,17 +55,17 @@ jogmap_read(void) static void -jogmap_markers(const char *args, const char **attrv) +jogmap_markers(const char* args, const char** attrv) { trk = route_head_alloc(); track_add_head(trk); } static void -jogmap_marker(const char *args, const char **attrv) +jogmap_marker(const char* args, const char** attrv) { - const char **avp = &attrv[0]; - waypoint *wpt = waypt_new(); + const char** avp = &attrv[0]; + waypoint* wpt = waypt_new(); while (*avp) { if (strcmp(avp[0], "lat") == 0) { @@ -88,11 +88,11 @@ static xg_tag_mapping jogmap_map[] = { { jogmap_markers, cb_start, "/markers" }, { jogmap_marker, cb_start, "/markers/marker" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; static void -jogmap_rd_init(const char *fname) +jogmap_rd_init(const char* fname) { trk = NULL; xml_init(fname, jogmap_map, NULL); diff --git a/gpsbabel/jtr.c b/gpsbabel/jtr.c index 504946ef3..861928a21 100644 --- a/gpsbabel/jtr.c +++ b/gpsbabel/jtr.c @@ -35,14 +35,14 @@ arglist_t jtr_args[] = { ARG_TERMINATOR }; -static gbfile *fin, *fout; -static avltree_t *trkpts; +static gbfile* fin, *fout; +static avltree_t* trkpts; static time_t -jtr_parse_time(const char *str, struct tm *tm, int *micro) +jtr_parse_time(const char* str, struct tm* tm, int* micro) { long int hms; - char *dot; + char* dot; hms = strtol(str, &dot, 10); if (hms > 0) { @@ -63,7 +63,7 @@ jtr_parse_time(const char *str, struct tm *tm, int *micro) } static time_t -jtr_parse_date(const char *str, struct tm *tm) +jtr_parse_date(const char* str, struct tm* tm) { int dmy = atoi(str); @@ -84,7 +84,7 @@ jtr_parse_date(const char *str, struct tm *tm) *******************************************************************************/ static void -jtr_rd_init(const char *fname) +jtr_rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); trkpts = avltree_init(0, MYNAME); @@ -100,14 +100,14 @@ jtr_rd_deinit(void) static void jtr_read(void) { - char *str; + char* str; int line = 0; - route_head *trk = NULL; + route_head* trk = NULL; while ((str = gbfgetstr(fin))) { - waypoint *wpt; + waypoint* wpt; struct tm tm; - char *tmp; + char* tmp; int column = -1; char valid = 'V'; double lat, lon; @@ -254,7 +254,7 @@ jtr_read(void) } static void -jtr_wr_init(const char *fname) +jtr_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); } @@ -266,9 +266,9 @@ jtr_wr_deinit(void) } static void -jtr_trkpt_disp_cb(const waypoint *wpt) +jtr_trkpt_disp_cb(const waypoint* wpt) { - char *str, *tmp; + char* str, *tmp; char stime[10], sdate[7], scourse[6], sspeed[8]; struct tm tm; @@ -331,7 +331,7 @@ ff_vecs_t jtr_vecs = { ff_type_file, { ff_cap_none, /* waypoints */ - ff_cap_read | ff_cap_write, /* tracks */ + (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */ ff_cap_none /* routes */ }, jtr_rd_init, diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index 0536581ff..4b9ebf67a 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -29,19 +29,19 @@ #endif // options -static char *opt_deficon = NULL; -static char *opt_export_lines = NULL; -static char *opt_export_points = NULL; -static char *opt_export_track = NULL; -static char *opt_line_width = NULL; -static char *opt_line_color = NULL; -static char *opt_floating = NULL; -static char *opt_extrude = NULL; -static char *opt_trackdata = NULL; -static char *opt_trackdirection = NULL; -static char *opt_units = NULL; -static char *opt_labels = NULL; -static char *opt_max_position_points = NULL; +static char* opt_deficon = NULL; +static char* opt_export_lines = NULL; +static char* opt_export_points = NULL; +static char* opt_export_track = NULL; +static char* opt_line_width = NULL; +static char* opt_line_color = NULL; +static char* opt_floating = NULL; +static char* opt_extrude = NULL; +static char* opt_trackdata = NULL; +static char* opt_trackdirection = NULL; +static char* opt_units = NULL; +static char* opt_labels = NULL; +static char* opt_max_position_points = NULL; static int export_lines; static int export_points; @@ -55,12 +55,12 @@ static int line_width; static int indent_level; -static waypoint *wpt_tmp; +static waypoint* wpt_tmp; static int wpt_tmp_queued; -static const char *posnfilename; -static char *posnfilenametmp; +static const char* posnfilename; +static char* posnfilenametmp; -static gbfile *ofd; +static gbfile* ofd; #define COORD_FORMAT "%.6f" #define ALT_FORMAT "%.2f" // Beyond a centimeter is fantasy. @@ -167,7 +167,7 @@ arglist_t kml_args[] = { static struct { int freshness; - const char *icon; + const char* icon; } kml_tracking_icons[] = { { 60, ICON_BASE "youarehere-60.png" }, // Red { 30, ICON_BASE "youarehere-30.png" }, // Yellow @@ -185,7 +185,7 @@ struct { #if ! HAVE_LIBEXPAT static void -kml_rd_init(const char *fname) +kml_rd_init(const char* fname) { fatal(MYNAME ": This build excluded KML support because expat was not installed.\n"); } @@ -218,20 +218,20 @@ xg_tag_mapping kml_map[] = { }; static -const char * kml_tags_to_ignore[] = { +const char* kml_tags_to_ignore[] = { "kml", "Document", "Folder", NULL, }; -void wpt_s(const char *args, const char **unused) +void wpt_s(const char* args, const char** unused) { wpt_tmp = waypt_new(); wpt_tmp_queued = 0; } -void wpt_e(const char *args, const char **unused) +void wpt_e(const char* args, const char** unused) { if (wpt_tmp_queued) { waypt_add(wpt_tmp); @@ -239,19 +239,19 @@ void wpt_e(const char *args, const char **unused) wpt_tmp_queued = 0; } -void wpt_name(const char *args, const char **unused) +void wpt_name(const char* args, const char** unused) { if (args) { wpt_tmp->shortname = xstrdup(args); } } -void wpt_desc(const char *args, const char **unused) +void wpt_desc(const char* args, const char** unused) { if (args) { - char *tmp, *c; + char* tmp, *c; - tmp = xstrdup((char *)args); + tmp = xstrdup((char*)args); c = lrtrim(tmp); if (*c) { wpt_tmp->description = xstrappend(wpt_tmp->description, c); @@ -260,12 +260,12 @@ void wpt_desc(const char *args, const char **unused) } } -void wpt_time(const char *args, const char **unused) +void wpt_time(const char* args, const char** unused) { wpt_tmp->creation_time = xml_parse_time(args, &wpt_tmp->microseconds); } -void wpt_coord(const char *args, const char **attrv) +void wpt_coord(const char* args, const char** attrv) { int n = 0; double lat, lon, alt; @@ -281,7 +281,7 @@ void wpt_coord(const char *args, const char **attrv) wpt_tmp_queued = 1; } -void wpt_icon(const char *args, const char **unused) +void wpt_icon(const char* args, const char** unused) { if (wpt_tmp) { wpt_tmp->icon_descr = xstrdup(args); @@ -289,14 +289,14 @@ void wpt_icon(const char *args, const char **unused) } } -void trk_coord(const char *args, const char **attrv) +void trk_coord(const char* args, const char** attrv) { int consumed = 0; double lat, lon, alt; - waypoint *trkpt; + waypoint* trkpt; int n = 0; - route_head *trk_head = route_head_alloc(); + route_head* trk_head = route_head_alloc(); if (wpt_tmp->shortname) { trk_head->rte_name = xstrdup(wpt_tmp->shortname); } @@ -325,7 +325,7 @@ void trk_coord(const char *args, const char **attrv) static void -kml_rd_init(const char *fname) +kml_rd_init(const char* fname) { xml_init(fname, kml_map, NULL); xml_ignore_tags(kml_tags_to_ignore); @@ -346,7 +346,7 @@ kml_rd_deinit(void) } static void -kml_wr_init(const char *fname) +kml_wr_init(const char* fname) { char u = 's'; waypt_init_bounds(&kml_bounds); @@ -385,7 +385,7 @@ kml_wr_init(const char *fname) * updated. */ static void -kml_wr_position_init(const char *fname) +kml_wr_position_init(const char* fname) { posnfilename = fname; posnfilenametmp = xstrappend(xstrdup(fname), "-"); @@ -432,7 +432,7 @@ kml_wr_position_deinit(void) * If negative, descrease the indent level. */ static void -kml_write_xml(int indent, const char *fmt, ...) +kml_write_xml(int indent, const char* fmt, ...) { va_list args; int i; @@ -462,14 +462,14 @@ kml_write_xml(int indent, const char *fmt, ...) * Never changes indention leve, but does honour it. */ static void -kml_write_xmle(const char *tag, const char *fmt, ...) +kml_write_xmle(const char* tag, const char* fmt, ...) { va_list args; int i; va_start(args, fmt); if (fmt && *fmt) { - char *tmp_ent = xml_entitize(fmt); + char* tmp_ent = xml_entitize(fmt); int needs_escaping = 0; for (i = 0; i < indent_level; i++) { gbfputs(" ", ofd); @@ -491,7 +491,7 @@ kml_write_xmle(const char *tag, const char *fmt, ...) } void -kml_output_linestyle(char *color, int width) +kml_output_linestyle(char* color, int width) { // Style settings for line strings kml_write_xml(1, "\n"); @@ -502,7 +502,7 @@ kml_output_linestyle(char *color, int width) #define hovertag(h) h ? 'h' : 'n' -static void kml_write_bitmap_style_(const char *style, const char * bitmap, +static void kml_write_bitmap_style_(const char* style, const char* bitmap, int highlighted, int force_heading) { int is_track = !strncmp(style, "track", 5); @@ -548,11 +548,11 @@ static void kml_write_bitmap_style_(const char *style, const char * bitmap, * and non-highlighted version of the style to allow the icons * to magnify slightly on a rollover. */ -static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap, - const char *customstyle) +static void kml_write_bitmap_style(kml_point_type pt_type, const char* bitmap, + const char* customstyle) { int force_heading = 0; - const char *style; + const char* style; switch (pt_type) { case kmlpt_track: style = "track"; @@ -590,7 +590,7 @@ static void kml_write_bitmap_style(kml_point_type pt_type, const char *bitmap, kml_write_xml(-1, "\n"); } -static void kml_output_timestamp(const waypoint *waypointp) +static void kml_output_timestamp(const waypoint* waypointp) { char time_string[64]; if (waypointp->creation_time) { @@ -606,13 +606,13 @@ static void kml_output_timestamp(const waypoint *waypointp) * Output the track summary. */ static -void kml_output_trkdescription(const route_head *header, computed_trkdata *td) +void kml_output_trkdescription(const route_head* header, computed_trkdata* td) { - char *max_alt_units; + char* max_alt_units; double max_alt; - char *min_alt_units; + char* min_alt_units; double min_alt; - char *distance_units; + char* distance_units; double distance; if (!td || !trackdata) { @@ -639,17 +639,17 @@ void kml_output_trkdescription(const route_head *header, computed_trkdata *td) TD2("Max Alt %.3f %s", max_alt, max_alt_units); } if (td->min_spd) { - char *spd_units; + char* spd_units; double spd = fmt_speed(td->min_spd, &spd_units); TD2("Min Speed %.1f %s", spd, spd_units); } if (td->max_spd) { - char *spd_units; + char* spd_units; double spd = fmt_speed(td->max_spd, &spd_units); TD2("Max Speed %.1f %s", spd, spd_units); } if (td->max_spd && td->start && td->end) { - char *spd_units; + char* spd_units; time_t elapsed = td->end - td->start; double spd = fmt_speed(td->distance_meters / elapsed, &spd_units); if (spd > 1.0) { @@ -697,7 +697,7 @@ void kml_output_trkdescription(const route_head *header, computed_trkdata *td) static -void kml_output_header(const route_head *header, computed_trkdata*td) +void kml_output_header(const route_head* header, computed_trkdata* td) { if (!realtime_positioning) { kml_write_xml(1, "\n"); @@ -713,7 +713,7 @@ void kml_output_header(const route_head *header, computed_trkdata*td) } static -int kml_altitude_known(const waypoint *waypoint) +int kml_altitude_known(const waypoint* waypoint) { if (waypoint->altitude == unknown_alt) { return 0; @@ -727,7 +727,7 @@ int kml_altitude_known(const waypoint *waypoint) } static -void kml_write_coordinates(const waypoint *waypointp) +void kml_write_coordinates(const waypoint* waypointp) { if (kml_altitude_known(waypointp)) { kml_write_xml(0, "" @@ -748,7 +748,7 @@ void kml_write_coordinates(const waypoint *waypointp) /* Rather than a default "top down" view, view from the side to highlight * topo features. */ -static void kml_output_lookat(const waypoint *waypointp) +static void kml_output_lookat(const waypoint* waypointp) { kml_write_xml(1, "\n"); kml_write_xml(0, "%f\n", waypointp->longitude); @@ -769,9 +769,9 @@ static void kml_output_positioning(void) } /* Output something interesing when we can for route and trackpoints */ -static void kml_output_description(const waypoint *pt) +static void kml_output_description(const waypoint* pt) { - char *alt_units; + char* alt_units; double alt; if (!trackdata) { @@ -799,12 +799,12 @@ static void kml_output_description(const waypoint *pt) TD("Temperature: %.1f", pt->temperature); } if WAYPT_HAS(pt, depth) { - char *depth_units; + char* depth_units; double depth = fmt_distance(pt->depth, &depth_units); TD2("Depth: %.1f %s", depth, depth_units); } if WAYPT_HAS(pt, speed) { - char *spd_units; + char* spd_units; double spd = fmt_speed(pt->speed, &spd_units); TD2("Speed: %.1f %s", spd, spd_units); } @@ -828,7 +828,7 @@ static void kml_output_description(const waypoint *pt) kml_write_xml(-1, "]]>\n"); } -static void kml_recompute_time_bounds(const waypoint *waypointp) +static void kml_recompute_time_bounds(const waypoint* waypointp) { if (waypointp->creation_time && (waypointp->creation_time < kml_time_min)) { kml_time_min = waypointp->creation_time; @@ -841,15 +841,15 @@ static void kml_recompute_time_bounds(const waypoint *waypointp) } } -static void kml_add_to_bounds(const waypoint *waypointp) +static void kml_add_to_bounds(const waypoint* waypointp) { waypt_add_to_bounds(&kml_bounds, waypointp); kml_recompute_time_bounds(waypointp); } -static void kml_output_point(const waypoint *waypointp, kml_point_type pt_type) +static void kml_output_point(const waypoint* waypointp, kml_point_type pt_type) { - const char *style; + const char* style; switch (pt_type) { case kmlpt_track: @@ -921,9 +921,9 @@ static void kml_output_point(const waypoint *waypointp, kml_point_type pt_type) } } -static void kml_output_tailer(const route_head *header) +static void kml_output_tailer(const route_head* header) { - queue *elem, *tmp; + queue* elem, *tmp; if (export_points && header->rte_waypt_ct > 0) { kml_write_xml(-1, "\n"); @@ -933,7 +933,7 @@ static void kml_output_tailer(const route_head *header) if (export_lines && header->rte_waypt_ct > 0) { int needs_multigeometry = 0; QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint *tpt = (waypoint *) elem; + waypoint* tpt = (waypoint*) elem; int first_in_trk = tpt->Q.prev == &header->waypoint_list; if (!first_in_trk && tpt->wpt_flags.new_trkseg) { needs_multigeometry = 1; @@ -960,7 +960,7 @@ static void kml_output_tailer(const route_head *header) } QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint *tpt = (waypoint *) elem; + waypoint* tpt = (waypoint*) elem; int first_in_trk = tpt->Q.prev == &header->waypoint_list; if (tpt->wpt_flags.new_trkseg) { if (!first_in_trk) { @@ -1018,11 +1018,11 @@ void kml_gc_make_ballonstyle(void) } static -char * -kml_lookup_gc_icon(const waypoint *waypointp) +char* +kml_lookup_gc_icon(const waypoint* waypointp) { - const char *icon; - char *rb; + const char* icon; + char* rb; /* This could be done so much better in C99 with designated * initializers... @@ -1077,10 +1077,10 @@ kml_lookup_gc_icon(const waypoint *waypointp) } static const -char * -kml_lookup_gc_container(const waypoint *waypointp) +char* +kml_lookup_gc_container(const waypoint* waypointp) { - const char *cont; + const char* cont; switch (waypointp->gc_data->container) { case gc_micro: @@ -1112,7 +1112,7 @@ kml_lookup_gc_container(const waypoint *waypointp) // Not thread safe. Return strings are small and it's silly to xasprintf/free // them so we use a static buffer. -char * kml_gc_mkstar(int rating) +char* kml_gc_mkstar(int rating) { static char tmp[40]; if (0 == rating % 10) { @@ -1124,9 +1124,9 @@ char * kml_gc_mkstar(int rating) return tmp; } -static void kml_geocache_pr(const waypoint *waypointp) +static void kml_geocache_pr(const waypoint* waypointp) { - char *p, *is; + char* p, *is; kml_write_xml(1, "\n"); @@ -1204,9 +1204,9 @@ static void kml_geocache_pr(const waypoint *waypointp) * WAYPOINTS */ -static void kml_waypt_pr(const waypoint *waypointp) +static void kml_waypt_pr(const waypoint* waypointp) { - const char *icon; + const char* icon; #if 0 // Experimental if (realtime_positioning) { @@ -1229,11 +1229,11 @@ static void kml_waypt_pr(const waypoint *waypointp) // Description if (waypointp->url && waypointp->url[0]) { - char * odesc = xml_entitize(waypointp->url); + char* odesc = xml_entitize(waypointp->url); kml_write_xml(0, "\n"); kml_write_xml(0, "\n"); if (waypointp->url_link_text && waypointp->url_link_text[0]) { - char *olink = xml_entitize(waypointp->url_link_text); + char* olink = xml_entitize(waypointp->url_link_text); kml_write_xml(0, "%s]]>", odesc, olink); xfree(olink); } else { @@ -1278,9 +1278,9 @@ static void kml_waypt_pr(const waypoint *waypointp) * TRACKPOINTS */ -static void kml_track_hdr(const route_head *header) +static void kml_track_hdr(const route_head* header) { - computed_trkdata *td; + computed_trkdata* td; track_recompute(header, &td); if (header->rte_waypt_ct > 0 && (export_lines || export_points)) { kml_output_header(header, td); @@ -1288,12 +1288,12 @@ static void kml_track_hdr(const route_head *header) xfree(td); } -static void kml_track_disp(const waypoint *waypointp) +static void kml_track_disp(const waypoint* waypointp) { kml_output_point(waypointp, kmlpt_track); } -static void kml_track_tlr(const route_head *header) +static void kml_track_tlr(const route_head* header) { if (header->rte_waypt_ct > 0 && (export_lines || export_points)) { kml_output_tailer(header); @@ -1316,40 +1316,40 @@ typedef enum { sl_float, sl_double, } sl_element; -static void kml_mt_simple_array(const route_head *header, - const char *name, const char *fmt_string, +static void kml_mt_simple_array(const route_head* header, + const char* name, const char* fmt_string, int offset, sl_element type) { - queue *elem, *tmp; + queue* elem, *tmp; kml_write_xml(1, "\n", name); QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - char *datap = (char*) elem + offset; + char* datap = (char*) elem + offset; switch (type) { case sl_char: { - char data = *(char *) datap; + char data = *(char*) datap; kml_write_xmle("gx:value", fmt_string, data); } break; case sl_uchar: { - unsigned char data = *(unsigned char *) datap; + unsigned char data = *(unsigned char*) datap; kml_write_xmle("gx:value", fmt_string, data); } break; case sl_int: { - int data = *(int *) datap; + int data = *(int*) datap; kml_write_xmle("gx:value", fmt_string, data); } break; case sl_float: { - float data = *(float *) datap; + float data = *(float*) datap; kml_write_xmle("gx:value", fmt_string, data); } break; case sl_double: { - double data = *(double *) datap; + double data = *(double*) datap; kml_write_xmle("gx:value", fmt_string, data); } break; @@ -1361,12 +1361,12 @@ static void kml_mt_simple_array(const route_head *header, } // True if at least two points in the track have timestamps. -static int track_has_time(const route_head *header) +static int track_has_time(const route_head* header) { - queue *elem, *tmp; + queue* elem, *tmp; int points_with_time = 0; QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint *tpt = (waypoint *)elem; + waypoint* tpt = (waypoint*)elem; if (tpt->creation_time) { points_with_time++; @@ -1379,21 +1379,21 @@ static int track_has_time(const route_head *header) } // Simulate a track_disp_all callback sequence for a single track. -static void write_as_linestring(const route_head *header) +static void write_as_linestring(const route_head* header) { - queue *elem, *tmp; + queue* elem, *tmp; kml_track_hdr(header); QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint *tpt = (waypoint *)elem; + waypoint* tpt = (waypoint*)elem; kml_track_disp(tpt); } kml_track_tlr(header); } -static void kml_mt_hdr(const route_head *header) +static void kml_mt_hdr(const route_head* header) { - queue *elem, *tmp; + queue* elem, *tmp; int has_cadence = 0; int has_depth = 0; int has_heartrate = 0; @@ -1415,7 +1415,7 @@ static void kml_mt_hdr(const route_head *header) QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { char time_string[64]; - waypoint *tpt = (waypoint *)elem; + waypoint* tpt = (waypoint*)elem; if (tpt->creation_time) { xml_fill_in_time(time_string, tpt->creation_time, tpt->microseconds, @@ -1430,7 +1430,7 @@ static void kml_mt_hdr(const route_head *header) // TODO: How to handle clamped, floating, extruded, etc.? QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) { - waypoint *tpt = (waypoint *)elem; + waypoint* tpt = (waypoint*)elem; if (kml_altitude_known(tpt)) { kml_write_xmle("gx:coord", COORD_FORMAT " " COORD_FORMAT " " ALT_FORMAT, @@ -1489,7 +1489,7 @@ static void kml_mt_hdr(const route_head *header) } } -static void kml_mt_tlr(const route_head *header) +static void kml_mt_tlr(const route_head* header) { if (track_has_time(header)) { kml_write_xml(-1, "\n"); @@ -1501,17 +1501,17 @@ static void kml_mt_tlr(const route_head *header) * ROUTES */ -static void kml_route_hdr(const route_head *header) +static void kml_route_hdr(const route_head* header) { kml_output_header(header, NULL); } -static void kml_route_disp(const waypoint *waypointp) +static void kml_route_disp(const waypoint* waypointp) { kml_output_point(waypointp, kmlpt_route); } -static void kml_route_tlr(const route_head *header) +static void kml_route_tlr(const route_head* header) { kml_output_tailer(header); } @@ -1590,8 +1590,8 @@ void kml_write_AbstractView(void) } static -void kml_mt_array_schema(const char *field_name, const char *display_name, - const char *type) +void kml_mt_array_schema(const char* field_name, const char* display_name, + const char* type) { kml_write_xml(1, "\n", field_name, type); @@ -1749,7 +1749,7 @@ void kml_write(void) * This depends on the table being sorted correctly. */ static const -char * +char* kml_get_posn_icon(int freshness) { int i; @@ -1764,10 +1764,10 @@ kml_get_posn_icon(int freshness) } -static route_head *posn_trk_head = NULL; +static route_head* posn_trk_head = NULL; static void -kml_wr_position(waypoint *wpt) +kml_wr_position(waypoint* wpt) { static time_t last_valid_fix; @@ -1811,7 +1811,7 @@ kml_wr_position(waypoint *wpt) track points if we've not moved a minimum distance from the beginnning of our accumulated track. */ { - waypoint *newest_posn= (waypoint *) QUEUE_LAST(&posn_trk_head->waypoint_list); + waypoint* newest_posn= (waypoint*) QUEUE_LAST(&posn_trk_head->waypoint_list); if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude), RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) { @@ -1836,7 +1836,7 @@ kml_wr_position(waypoint *wpt) */ while (max_position_points && (posn_trk_head->rte_waypt_ct >= max_position_points)) { - waypoint *tonuke = (waypoint *) QUEUE_FIRST(&posn_trk_head->waypoint_list); + waypoint* tonuke = (waypoint*) QUEUE_FIRST(&posn_trk_head->waypoint_list); track_del_wpt(posn_trk_head, tonuke); } diff --git a/gpsbabel/lmx.c b/gpsbabel/lmx.c index bef1bfe3f..53d43eef7 100644 --- a/gpsbabel/lmx.c +++ b/gpsbabel/lmx.c @@ -29,10 +29,10 @@ #include "defs.h" #include "xmlgeneric.h" -static gbfile *ofd; -static waypoint *wpt_tmp; -char *urllink, *urllinkt; -static char *binary = NULL; +static gbfile* ofd; +static waypoint* wpt_tmp; +char* urllink, *urllinkt; +static char* binary = NULL; #define MYNAME "lmx" @@ -52,7 +52,7 @@ arglist_t lmx_args[] = { static void -lmx_wr_init(const char *fname) +lmx_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); } @@ -63,7 +63,7 @@ lmx_wr_deinit(void) gbfclose(ofd); } -static char * +static char* lmx_stag(int tag) { switch (tag) { @@ -174,7 +174,7 @@ lmx_end_tag(int tag, int indent) } static void -lmx_write_xml(int tag, const char *data, int indent) +lmx_write_xml(int tag, const char* data, int indent) { lmx_start_tag(tag, indent); @@ -182,7 +182,7 @@ lmx_write_xml(int tag, const char *data, int indent) gbfputc(0x03, ofd); // inline string follows gbfputcstr(data, ofd); } else { - char *tmp_ent = xml_entitize(data); + char* tmp_ent = xml_entitize(data); gbfputs(tmp_ent, ofd); xfree(tmp_ent); } @@ -191,10 +191,10 @@ lmx_write_xml(int tag, const char *data, int indent) } static void -lmx_print(const waypoint *wpt) +lmx_print(const waypoint* wpt) { - const char *oname; - char *odesc; + const char* oname; + char* odesc; char tbuf[100]; /* @@ -308,11 +308,11 @@ static xg_tag_mapping gl_map[] = { { lmx_lm_link, cb_cdata, LM "/lm:mediaLink/lm:url" }, { lmx_lm_linkt, cb_cdata, LM "/lm:mediaLink/lm:name" }, { lmx_lm_mlink_e, cb_end, LM "/lm:mediaLink" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; static void -lmx_rd_init(const char *fname) +lmx_rd_init(const char* fname) { xml_init(fname, gl_map, NULL); } @@ -332,67 +332,67 @@ lmx_rd_deinit(void) static void -lmx_lm_start(const char *args, const char **unused) +lmx_lm_start(const char* args, const char** unused) { wpt_tmp = waypt_new(); } static void -lmx_lm_end(const char *args, const char **unused) +lmx_lm_end(const char* args, const char** unused) { waypt_add(wpt_tmp); } static void -lmx_lm_lat(const char *args, const char **unused) +lmx_lm_lat(const char* args, const char** unused) { wpt_tmp->latitude = atof(args); } static void -lmx_lm_lon(const char *args, const char **unused) +lmx_lm_lon(const char* args, const char** unused) { wpt_tmp->longitude = atof(args); } static void -lmx_lm_alt(const char *args, const char **unused) +lmx_lm_alt(const char* args, const char** unused) { wpt_tmp->altitude = atof(args); } static void -lmx_lm_name(const char *args, const char **unused) +lmx_lm_name(const char* args, const char** unused) { wpt_tmp->shortname = xstrdup(args); } static void -lmx_lm_desc(const char *args, const char **unused) +lmx_lm_desc(const char* args, const char** unused) { wpt_tmp->description = xstrdup(args); } static void -lmx_lm_mlink_s(const char *args, const char **unused) +lmx_lm_mlink_s(const char* args, const char** unused) { urllink = urllinkt = NULL; } static void -lmx_lm_link(const char *args, const char **unused) +lmx_lm_link(const char* args, const char** unused) { urllink = xstrdup(args); } static void -lmx_lm_linkt(const char *args, const char **unused) +lmx_lm_linkt(const char* args, const char** unused) { urllinkt = xstrdup(args); } static void -lmx_lm_mlink_e(const char *args, const char **unused) +lmx_lm_mlink_e(const char* args, const char** unused) { waypt_add_url(wpt_tmp, urllink, urllinkt); } @@ -401,7 +401,7 @@ lmx_lm_mlink_e(const char *args, const char **unused) ff_vecs_t lmx_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write, /* waypoints */ + (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */ ff_cap_none, /* tracks */ ff_cap_none /* routes */ }, diff --git a/gpsbabel/lowranceusr.c b/gpsbabel/lowranceusr.c index 7f0c57e6c..abad2ce30 100644 --- a/gpsbabel/lowranceusr.c +++ b/gpsbabel/lowranceusr.c @@ -38,7 +38,7 @@ typedef struct lowranceusr_icon_mapping { const int value; - const char *icon; + const char* icon; } lowranceusr_icon_mapping_t; #define DEF_ICON 10001 @@ -192,8 +192,8 @@ const lowranceusr_icon_mapping_t lowranceusr_icon_value_table[] = { { -1, NULL } }; -static gbfile *file_in; -static gbfile *file_out; +static gbfile* file_in; +static gbfile* file_out; static short_handle mkshort_handle; static unsigned short waypt_out_count; @@ -201,13 +201,13 @@ static unsigned int trail_count, lowrance_route_count; static int trail_point_count; static char continuous = 1; static short num_section_points; -static route_head *trk_head; -static route_head *rte_head; -static char *ignoreicons; -static char *writeasicons; -static char *merge; -static char *seg_break; -static char *wversion_arg; +static route_head* trk_head; +static route_head* rte_head; +static char* ignoreicons; +static char* writeasicons; +static char* merge; +static char* seg_break; +static char* wversion_arg; static int reading_version; static int writing_version; @@ -224,7 +224,7 @@ static int writing_version; const time_t base_time_secs = 946706400; static int -lowranceusr_readstr(char *buf, const int maxlen, gbfile *file) +lowranceusr_readstr(char* buf, const int maxlen, gbfile* file) { int org, len; @@ -253,10 +253,10 @@ lowranceusr_readstr(char *buf, const int maxlen, gbfile *file) return len; } -const char * +const char* lowranceusr_find_desc_from_icon_number(const int icon) { - const lowranceusr_icon_mapping_t *i; + const lowranceusr_icon_mapping_t* i; for (i = lowranceusr_icon_value_table; i->icon; i++) { if (icon == i->value) { @@ -268,9 +268,9 @@ lowranceusr_find_desc_from_icon_number(const int icon) } int -lowranceusr_find_icon_number_from_desc(const char *desc) +lowranceusr_find_icon_number_from_desc(const char* desc) { - const lowranceusr_icon_mapping_t *i; + const lowranceusr_icon_mapping_t* i; int n; if (!desc) { @@ -322,7 +322,7 @@ arglist_t lowranceusr_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); } @@ -334,7 +334,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); mkshort_handle = mkshort_new_handle(); @@ -378,7 +378,7 @@ lat_deg_to_mm(double x) } static void -lowranceusr_parse_waypt(waypoint *wpt_tmp) +lowranceusr_parse_waypt(waypoint* wpt_tmp) { char buff[MAXUSRSTRINGSIZE + 1]; int text_len; @@ -454,7 +454,7 @@ lowranceusr_parse_routes(void) short int num_routes, num_legs; int i,j; int text_len; - waypoint *wpt_tmp; + waypoint* wpt_tmp; num_routes = gbfgetint16(file_in); @@ -514,7 +514,7 @@ lowranceusr_parse_icons(void) /* symbol */ (void) gbfread(&buff[0], 4, 1, file_in); } else { - waypoint *wpt_tmp; + waypoint* wpt_tmp; wpt_tmp = waypt_new(); /* position coord lat & long */ @@ -538,8 +538,8 @@ lowranceusr_parse_trails(void) short int num_trails, num_trail_points, num_section_points; int i,j, trk_num, itmp; int text_len; - waypoint *wpt_tmp; - route_head *trk_tmp; + waypoint* wpt_tmp; + route_head* trk_tmp; /* num trails */ num_trails = gbfgetint16(file_in); @@ -654,7 +654,7 @@ data_read(void) } for (i = 0; i < NumWaypoints; i++) { - waypoint *wpt_tmp; + waypoint* wpt_tmp; wpt_tmp = waypt_new(); @@ -676,12 +676,12 @@ data_read(void) } static void -lowranceusr_waypt_disp(const waypoint *wpt) +lowranceusr_waypt_disp(const waypoint* wpt) { int text_len, Lat, Lon, Time, SymbolId; short int WayptType; - char *name; - char *comment; + char* name; + char* comment; int alt = METERS_TO_FEET(wpt->altitude); if (wpt->altitude == unknown_alt) { @@ -784,7 +784,7 @@ lowranceusr_waypt_disp(const waypoint *wpt) } static void -lowranceusr_waypt_pr(const waypoint *wpt) +lowranceusr_waypt_pr(const waypoint* wpt) { /* our personal waypoint counter */ @@ -808,7 +808,7 @@ lowranceusr_waypt_pr(const waypoint *wpt) * 4 bytes symbol */ static void -lowranceusr_write_icon(const waypoint *wpt) +lowranceusr_write_icon(const waypoint* wpt) { int latmm = lat_deg_to_mm(wpt->latitude); int lonmm = lon_deg_to_mm(wpt->longitude); @@ -837,10 +837,10 @@ lowranceusr_write_icon(const waypoint *wpt) */ static void -lowranceusr_track_hdr(const route_head *trk) +lowranceusr_track_hdr(const route_head* trk) { int text_len; - char *name, tmp_name[20]; + char* name, tmp_name[20]; short num_trail_points, max_trail_size; char visible=1; @@ -890,10 +890,10 @@ lowranceusr_track_hdr(const route_head *trk) } static void -lowranceusr_route_hdr(const route_head *rte) +lowranceusr_route_hdr(const route_head* rte) { int text_len; - char *name, tmp_name[20]; + char* name, tmp_name[20]; short num_legs; char route_reversed=0; @@ -927,7 +927,7 @@ lowranceusr_route_hdr(const route_head *rte) } static void -lowranceusr_track_disp(const waypoint *wpt) +lowranceusr_track_disp(const waypoint* wpt) { int lat, lon; @@ -949,10 +949,10 @@ lowranceusr_track_disp(const waypoint *wpt) } static void -lowranceusr_merge_track_hdr(const route_head *trk) +lowranceusr_merge_track_hdr(const route_head* trk) { int text_len; - char *name, tmp_name[20]; + char* name, tmp_name[20]; if (++trail_count == 1) { if (trk->rte_name) { @@ -981,7 +981,7 @@ lowranceusr_merge_track_hdr(const route_head *trk) } static void -lowranceusr_merge_track_tlr(const route_head *trk) +lowranceusr_merge_track_tlr(const route_head* trk) { short num_trail_points, max_trail_size; char visible=1; @@ -1006,7 +1006,7 @@ lowranceusr_merge_track_tlr(const route_head *trk) } static void -lowranceusr_merge_track_hdr_2(const route_head *trk) +lowranceusr_merge_track_hdr_2(const route_head* trk) { continuous = 0; } diff --git a/gpsbabel/mag_pdb.c b/gpsbabel/mag_pdb.c index 0ff03b29a..a26c5acce 100644 --- a/gpsbabel/mag_pdb.c +++ b/gpsbabel/mag_pdb.c @@ -34,7 +34,7 @@ #define PROUTE_MAGIC 0x766d6170 /* vmap */ #define PROUTE_ROUTE 0x49444154 /* IDAT */ -static pdbfile *file_in; +static pdbfile* file_in; static arglist_t magpdb_args[] = { ARG_TERMINATOR @@ -58,17 +58,17 @@ magpdb_to_degree(const int degx) } static void -magpdb_read_data(const char *data, const size_t data_len) +magpdb_read_data(const char* data, const size_t data_len) { - route_head *route; - char *cin = (char *)data; - char *cend = cin + data_len; + route_head* route; + char* cin = (char*)data; + char* cend = cin + data_len; route = route_head_alloc(); route_add_head(route); while (cin < cend) { - char *lend; + char* lend; int len; lend = strchr(cin, '\x0A'); @@ -94,7 +94,7 @@ magpdb_read_data(const char *data, const size_t data_len) } /* check, if line starts with time and distance */ else if (3 == sscanf(cin, "%d:%d %lf", &hour, &min, &distance)) { - char *buff, *comma; + char* buff, *comma; /* detect time-format settings, 12,0 or 12.0 */ @@ -115,8 +115,8 @@ magpdb_read_data(const char *data, const size_t data_len) comma = cin; while ((comma = strchr(comma, separator))) { int i, xlat, xlon; - waypoint *wpt; - char *cx; + waypoint* wpt; + char* cx; comma++; @@ -153,7 +153,7 @@ magpdb_read_data(const char *data, const size_t data_len) cx = strchr(comma, ')'); /* find tailing notes after the coordinates */ if (cx != NULL) { - char *tail = lrtrim(++cx); + char* tail = lrtrim(++cx); if (*tail != '\0') { wpt->notes = xstrdup(tail); } @@ -179,7 +179,7 @@ magpdb_read_data(const char *data, const size_t data_len) * &&& gobal callbacks &&& * ----------------------------------------------------------------------------------------- */ -static void magpdb_rd_init(const char *fname) +static void magpdb_rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -191,7 +191,7 @@ static void magpdb_rd_deinit(void) static void magpdb_read(void) { - pdbrec_t *pdb_rec; + pdbrec_t* pdb_rec; is_fatal((file_in->creator != PROUTE_MAGIC), /* identify the database */ MYNAME ": Not a Map&Guide pdb file (0x%08x).", file_in->creator); @@ -203,7 +203,7 @@ static void magpdb_read(void) MYNAME ": Unknown pdb data type (0x%08x).", file_in->type); for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - char *data = (char *)pdb_rec->data; + char* data = (char*)pdb_rec->data; if (be_read16(data) == 0) { int len = be_read16(data + 2); diff --git a/gpsbabel/magellan.h b/gpsbabel/magellan.h index cc8eecc48..582f9c75a 100644 --- a/gpsbabel/magellan.h +++ b/gpsbabel/magellan.h @@ -36,19 +36,19 @@ typedef enum { typedef struct pid_to_model { meridian_model model; int pid; - const char *model_n; + const char* model_n; } pid_to_model_t; typedef struct icon_mapping { - const char *token; - const char *icon; + const char* token; + const char* icon; } icon_mapping_t; -const char * mag_find_descr_from_token(const char *token); -const char * mag_find_token_from_descr(const char *icon); +const char* mag_find_descr_from_token(const char* token); +const char* mag_find_token_from_descr(const char* icon); -unsigned int mag_checksum(const char *const buf); -char * m330_cleanse(char *istring); +unsigned int mag_checksum(const char* const buf); +char* m330_cleanse(char* istring); -waypoint * mag_trkparse(char *trkmsg); -void mag_rteparse(char *rtemsg); +waypoint* mag_trkparse(char* trkmsg); +void mag_rteparse(char* rtemsg); diff --git a/gpsbabel/maggeo.c b/gpsbabel/maggeo.c index 402053960..27a084722 100644 --- a/gpsbabel/maggeo.c +++ b/gpsbabel/maggeo.c @@ -30,21 +30,21 @@ /* Turn this on (remove) after 5.2 becomes widespread. */ #define FIRMWARE_DOES_88591 0 -static gbfile *maggeofile_in; -static gbfile *maggeofile_out; +static gbfile* maggeofile_in; +static gbfile* maggeofile_out; static short_handle desc_handle = NULL; -static time_t maggeo_parsedate(char *dmy); +static time_t maggeo_parsedate(char* dmy); static void -maggeo_writemsg(const char * const buf) +maggeo_writemsg(const char* const buf) { unsigned int osum = mag_checksum(buf); gbfprintf(maggeofile_out, "$%s*%02X\r\n",buf, osum); } static void -maggeo_rd_init(const char *fname) +maggeo_rd_init(const char* fname) { maggeofile_in = gbfopen(fname, "rb", MYNAME); } @@ -56,7 +56,7 @@ maggeo_rd_deinit(void) } static void -maggeo_wr_init(const char *fname) +maggeo_wr_init(const char* fname) { if (waypt_count() > 200) { fatal(MYNAME ": eXplorist does not support more than 200 waypoints in one .gs file.\nDecrease the number of waypoints sent.\n"); @@ -78,12 +78,12 @@ maggeo_wr_deinit(void) static void maggeo_read(void) { - char *buff; + char* buff; while ((buff = gbfgetstr(maggeofile_in))) { - waypoint *wpt_tmp; - geocache_data *gcdata; - char *s = NULL; + waypoint* wpt_tmp; + geocache_data* gcdata; + char* s = NULL; int fld; buff = lrtrim(buff); @@ -170,14 +170,14 @@ maggeo_read(void) * Note: returns allocated buffer that must be freed by caller. */ static -char * +char* maggeo_fmtdate(time_t t) { #define SZ 16 - struct tm *tm = NULL; + struct tm* tm = NULL; int date; - char *cbuf = xmalloc(SZ); + char* cbuf = xmalloc(SZ); cbuf[0] = '\0'; if (t > 0) { @@ -197,7 +197,7 @@ maggeo_fmtdate(time_t t) * century is three digits but anything from before 2000, we'd have * two digit years. This makes this easier to parse as strings. */ -static time_t maggeo_parsedate(char *dmy) +static time_t maggeo_parsedate(char* dmy) { struct tm tm; char dd[3]; @@ -230,9 +230,9 @@ static time_t maggeo_parsedate(char *dmy) */ static void -append(char *buf, const char *str) +append(char* buf, const char* str) { - char *cleansed1, *cleansed2; + char* cleansed1, *cleansed2; strcat(buf, ","); @@ -256,18 +256,18 @@ append(char *buf, const char *str) } static void -maggeo_waypt_pr(const waypoint *waypointp) +maggeo_waypt_pr(const waypoint* waypointp) { char obuf[4096]; double ilon, ilat; double lon, lat; int lon_deg, lat_deg; - char *shortname; - char *cname = NULL; - const char *ctype = NULL; - char *placer = NULL; - char *lfounddate = NULL; - char *placeddate = NULL; + char* shortname; + char* cname = NULL; + const char* ctype = NULL; + char* placer = NULL; + char* lfounddate = NULL; + char* placeddate = NULL; ilat = waypointp->latitude; ilon = waypointp->longitude; @@ -360,7 +360,7 @@ maggeo_write(void) ff_vecs_t maggeo_vecs = { ff_type_file, - { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none }, + { (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none }, maggeo_rd_init, maggeo_wr_init, maggeo_rd_deinit, diff --git a/gpsbabel/magnav.c b/gpsbabel/magnav.c index f615c728d..f3f639a20 100644 --- a/gpsbabel/magnav.c +++ b/gpsbabel/magnav.c @@ -49,13 +49,13 @@ struct record { char unknown3; /* always 'a' */ }; -static pdbfile *file_in; -static pdbfile *file_out; +static pdbfile* file_in; +static pdbfile* file_out; static short_handle mkshort_handle; static int ct; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -67,7 +67,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); mkshort_handle = mkshort_new_handle(); @@ -85,27 +85,27 @@ wr_deinit(void) static void data_read(void) { - struct record *rec; - pdbrec_t *pdb_rec; + struct record* rec; + pdbrec_t* pdb_rec; if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) { fatal(MYNAME ": Not a Magellan Navigator file.\n"); } for (pdb_rec = file_in->rec_list; pdb_rec; pdb_rec = pdb_rec->next) { - waypoint *wpt_tmp; - char *vdata; + waypoint* wpt_tmp; + char* vdata; struct tm tm; memset(&tm, 0, sizeof(tm)); wpt_tmp = waypt_new(); - rec = (struct record *) pdb_rec->data; + rec = (struct record*) pdb_rec->data; wpt_tmp->altitude = be_read32(&rec->elevation); wpt_tmp->longitude = be_read32(&rec->longitude) / 1e5; wpt_tmp->latitude = be_read32(&rec->latitude) / 1e5; - vdata = (char *) pdb_rec->data + sizeof(*rec); + vdata = (char*) pdb_rec->data + sizeof(*rec); wpt_tmp->shortname = xstrdup(vdata); vdata += strlen(vdata) + 1; @@ -129,13 +129,13 @@ data_read(void) static void -my_writewpt(const waypoint *wpt) +my_writewpt(const waypoint* wpt) { - struct record *rec; - struct tm *tm; - char *vdata; + struct record* rec; + struct tm* tm; + char* vdata; time_t tm_t; - const char *sn = global_opts.synthesize_shortnames ? + const char* sn = global_opts.synthesize_shortnames ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname; @@ -175,7 +175,7 @@ my_writewpt(const waypoint *wpt) rec->plot = 0; rec->unknown3 = 'a'; - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); if (sn) { strncpy(vdata, sn, 21); vdata[20] = '\0'; @@ -194,7 +194,7 @@ my_writewpt(const waypoint *wpt) vdata[1] = '\0'; vdata += 2; - pdb_write_rec(file_out, 0, 0, ct++, rec, (char *)vdata - (char *)rec); + pdb_write_rec(file_out, 0, 0, ct++, rec, (char*)vdata - (char*)rec); xfree(rec); } @@ -202,7 +202,7 @@ my_writewpt(const waypoint *wpt) static void data_write(void) { - static char *appinfo = + static char* appinfo = "\0\x01" "User\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -229,7 +229,7 @@ data_write(void) file_out->type = MYTYPE; /* CWpt */ file_out->creator = MYCREATOR; /* cGPS */ file_out->version = 1; - file_out->appinfo = (void *)appinfo; + file_out->appinfo = (void*)appinfo; file_out->appinfo_len = 276; waypt_disp_all(my_writewpt); diff --git a/gpsbabel/magproto.c b/gpsbabel/magproto.c index 29b4088b5..40da8aa28 100644 --- a/gpsbabel/magproto.c +++ b/gpsbabel/magproto.c @@ -42,27 +42,27 @@ static int broken_sportrak; #define debug_serial (global_opts.debug_level > 1) -static char *termread(char *ibuf, int size); -static void termwrite(char *obuf, int size); +static char* termread(char* ibuf, int size); +static void termwrite(char* obuf, int size); static void mag_readmsg(gpsdata_type objective); static void mag_handon(void); static void mag_handoff(void); static short_handle mkshort_handle = NULL; -static char *deficon = NULL; -static char *bs = NULL; -static char *cmts = NULL; -static char *noack = NULL; -static char *nukewpt = NULL; +static char* deficon = NULL; +static char* bs = NULL; +static char* cmts = NULL; +static char* noack = NULL; +static char* nukewpt = NULL; static int route_out_count; static int waypoint_read_count; static int wpt_len = 8; -static const char *curfname; +static const char* curfname; static int extension_hint; // For Explorist GC/510/610/710 familes, bludgeon in GPX support. // (This has nothing to do with the Explorist 100...600 products.) -static ff_vecs_t *gpx_vec; -static mag_info *explorist_info; -static char ** os_gpx_files(const char *dirname); +static ff_vecs_t* gpx_vec; +static mag_info* explorist_info; +static char** os_gpx_files(const char* dirname); /* * Magellan's firmware is *horribly* slow to send the next packet after @@ -85,8 +85,8 @@ typedef enum { */ typedef struct mag_rte_elem { queue Q; /* My link pointers */ - char *wpt_name; - char *wpt_icon; + char* wpt_name; + char* wpt_icon; } mag_rte_elem; /* @@ -94,26 +94,26 @@ typedef struct mag_rte_elem { */ typedef struct mag_rte_head_ { queue Q; /* Queue head for child rte_elems */ - char *rte_name; + char* rte_name; int nelems; } mag_rte_head; static queue rte_wpt_tmp; /* temporary PGMNWPL msgs for routes */ -static gbfile *magfile_h; +static gbfile* magfile_h; static mag_rxstate magrxstate; static int mag_error; static unsigned int last_rx_csum; static int found_done; static int got_version; static int is_file = 0; -static route_head *trk_head; +static route_head* trk_head; static int ignore_unable; -static waypoint * mag_wptparse(char *); -typedef char * (cleanse_fn)(char *); -static cleanse_fn *mag_cleanse; -static const char ** os_get_magellan_mountpoints(); +static waypoint* mag_wptparse(char*); +typedef char* (cleanse_fn)(char*); +static cleanse_fn* mag_cleanse; +static const char** os_get_magellan_mountpoints(); static icon_mapping_t gps315_icon_table[] = { { "a", "filled circle" }, @@ -215,18 +215,18 @@ pid_to_model_t pid_to_model[] = { { mm_unknown, 0, NULL } }; -static icon_mapping_t *icon_mapping = map330_icon_table; +static icon_mapping_t* icon_mapping = map330_icon_table; /* * For each receiver type, return a "cleansed" version of the string * that's valid for a waypoint name or comment. The string should be * freed when you're done with it. */ -static char * -m315_cleanse(char *istring) +static char* +m315_cleanse(char* istring) { - char *rstring = (char*) xmalloc(strlen(istring)+1); - char *i,*o; + char* rstring = (char*) xmalloc(strlen(istring)+1); + char* i,*o; static char m315_valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"; for (o=rstring,i=istring; *i; i++) { @@ -241,14 +241,14 @@ m315_cleanse(char *istring) /* * Do same for 330, Meridian, and SportTrak. */ -char * -m330_cleanse(char *istring) +char* +m330_cleanse(char* istring) { static char m330_valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " "abcdefghijklmnopqrstuvwxyz" "0123456789+-.'/!@#<%^&>()=:\\"; - char *rstring = (char*) xmalloc(strlen(istring)+1); - char *o, *i; + char* rstring = (char*) xmalloc(strlen(istring)+1); + char* o, *i; for (o=rstring,i=istring; *i; i++) { if (strchr(m330_valid_chars, *i)) { @@ -264,10 +264,10 @@ m330_cleanse(char *istring) * the Magellan protocol. */ unsigned int -mag_checksum(const char * const buf) +mag_checksum(const char* const buf) { int csum = 0; - const char *p; + const char* p; for (p = buf; *p; p++) { csum ^= *p; @@ -276,10 +276,10 @@ mag_checksum(const char * const buf) return csum; } static unsigned int -mag_pchecksum(const char * const buf, int len) +mag_pchecksum(const char* const buf, int len) { int csum = 0; - const char *p = buf; + const char* p = buf; for (; len ; len--) { csum ^= *p++; } @@ -287,7 +287,7 @@ mag_pchecksum(const char * const buf, int len) } static void -mag_writemsg(const char * const buf) +mag_writemsg(const char* const buf) { unsigned int osum = mag_checksum(buf); int retry_cnt = 5; @@ -367,11 +367,11 @@ mag_handoff(void) } void -mag_verparse(char *ibuf) +mag_verparse(char* ibuf) { int prodid = mm_unknown; char version[1024]; - pid_to_model_t *pp = pid_to_model; + pid_to_model_t* pp = pid_to_model; got_version = 1; sscanf(ibuf,"$PMGNVER,%d,%[^,]", &prodid, version); @@ -416,8 +416,8 @@ mag_readmsg(gpsdata_type objective) of escaped FFFFFFFF) may need more size */ int isz; unsigned int isum; - char *isump; - char *gr; + char* isump; + char* gr; int retrycnt = 20; retry: @@ -481,7 +481,7 @@ retry: return; } if (strncmp(ibuf, "$PMGNWPL,", 7) == 0) { - waypoint *wpt = mag_wptparse(ibuf); + waypoint* wpt = mag_wptparse(ibuf); waypoint_read_count++; if (global_opts.verbose_status) { waypt_status_disp(waypoint_read_count, @@ -508,7 +508,7 @@ retry: } } if (strncmp(ibuf, "$PMGNTRK,", 7) == 0) { - waypoint *wpt = mag_trkparse(ibuf); + waypoint* wpt = mag_trkparse(ibuf); /* * Allow lazy allocation of track head. */ @@ -516,8 +516,8 @@ retry: /* These tracks don't have names, so derive one * from input filename. */ - char *e; - const char *s = get_filename(curfname); + char* e; + const char* s = get_filename(curfname); trk_head = route_head_alloc(); @@ -557,10 +557,10 @@ retry: } } -static void *serial_handle = NULL; +static void* serial_handle = NULL; static int -terminit(const char *portname, int create_ok) +terminit(const char* portname, int create_ok) { if (gbser_is_serial(portname)) { if (serial_handle = gbser_init(portname), NULL != serial_handle) { @@ -585,7 +585,7 @@ terminit(const char *portname, int create_ok) } } -static char *termread(char *ibuf, int size) +static char* termread(char* ibuf, int size) { if (is_file) { return gbfgets(ibuf, size, magfile_h); @@ -611,20 +611,20 @@ static char *termread(char *ibuf, int size) */ static void -mag_dequote(char *ibuf) +mag_dequote(char* ibuf) { - char *esc = NULL; + char* esc = NULL; while ((esc = strchr(ibuf, 0x1b))) { int nremains = strlen(esc); if (nremains >= 3) { static const char hex[17] = "0123456789ABCDEF"; - char *c1 = strchr(hex, esc[1]); - char *c2 = strchr(hex, esc[2]); + char* c1 = strchr(hex, esc[1]); + char* c2 = strchr(hex, esc[2]); if (c1 && c2) { int escv = (c1 - hex) * 16 + (c2 - hex); if (escv == 255) { /* corrupted data */ - char *tmp = esc + 1; + char* tmp = esc + 1; while (*tmp == 'F') { tmp++; } @@ -643,7 +643,7 @@ mag_dequote(char *ibuf) } static void -termwrite(char *obuf, int size) +termwrite(char* obuf, int size) { if (is_file) { size_t nw; @@ -714,7 +714,7 @@ arglist_t mag_fargs[] = { * The part of the serial init that's common to read and write. */ static void -mag_serial_init_common(const char *portname) +mag_serial_init_common(const char* portname) { time_t now, later; @@ -766,18 +766,18 @@ mag_serial_init_common(const char *portname) } static void -mag_rd_init_common(const char *portname) +mag_rd_init_common(const char* portname) { - char *ext; + char* ext; waypoint_read_count = 0; // For Explorist GC, intercept the device access and redirect to GPX. // We actually do the rd_init() inside read as we may have multiple // files that we have to read. if (0 == strcmp(portname, "usb:")) { - const char **dlist = os_get_magellan_mountpoints(); + const char** dlist = os_get_magellan_mountpoints(); explorist_info = explorist_ini_get(dlist); if (explorist_info) { - char *vec_opts = NULL; + char* vec_opts = NULL; gpx_vec = find_vec("gpx", &vec_opts); } return; @@ -824,7 +824,7 @@ mag_rd_init_common(const char *portname) } static void -mag_rd_init(const char *portname) +mag_rd_init(const char* portname) { explorist = 0; suppress_ack = 1; @@ -832,14 +832,14 @@ mag_rd_init(const char *portname) } static void -magX_rd_init(const char *portname) +magX_rd_init(const char* portname) { explorist = 1; mag_rd_init_common(portname); } static void -mag_wr_init_common(const char *portname) +mag_wr_init_common(const char* portname) { suppress_ack = 0; if (bs) { @@ -870,7 +870,7 @@ mag_wr_init_common(const char *portname) * Entry point for extended (explorist) points. */ static void -magX_wr_init(const char *portname) +magX_wr_init(const char* portname) { wpt_len = 20; explorist = 1; @@ -880,7 +880,7 @@ magX_wr_init(const char *portname) } static void -mag_wr_init(const char *portname) +mag_wr_init(const char* portname) { explorist = 0; wpt_len = 8; @@ -922,12 +922,12 @@ mag_deinit(void) static char ifield[20][100]; static -void parse_istring(char *istring) +void parse_istring(char* istring) { int f = 0; int n,x; while (istring[0]) { - char *fp = ifield[f]; + char* fp = ifield[f]; x = sscanf(istring, "%[^,]%n", fp, &n); f++; if (x) { @@ -947,8 +947,8 @@ void parse_istring(char *istring) * $PMGNTRK,3605.259,N,08644.389,W,00151,M,201444.61,A,,020302*66 * create and return a populated waypoint. */ -waypoint * -mag_trkparse(char *trkmsg) +waypoint* +mag_trkparse(char* trkmsg) { double latdeg, lngdeg; int alt; @@ -958,7 +958,7 @@ mag_trkparse(char *trkmsg) int hms; int fracsecs; struct tm tm; - waypoint *waypt; + waypoint* waypt; waypt = waypt_new(); @@ -1017,17 +1017,17 @@ mag_trkparse(char *trkmsg) * generate a route. */ void -mag_rteparse(char *rtemsg) +mag_rteparse(char* rtemsg) { char descr[100]; int n; int frags,frag,rtenum; char xbuf[100],next_stop[100],abuf[100]; - char *currtemsg; - static mag_rte_head *mag_rte_head; - mag_rte_elem *rte_elem; - char *p; - char *rte_name = NULL; + char* currtemsg; + static mag_rte_head* mag_rte_head; + mag_rte_elem* rte_elem; + char* p; + char* rte_name = NULL; descr[0] = 0; #if 0 @@ -1039,7 +1039,7 @@ mag_rteparse(char *rtemsg) /* Explorist has a route name here */ if (explorist) { - char *ca, *ce; + char* ca, *ce; ca = rtemsg + n; is_fatal(*ca++ != ',', MYNAME ": Incorrectly formatted route line '%s'", rtemsg); @@ -1114,8 +1114,8 @@ mag_rteparse(char *rtemsg) * gpsbabel internal structs now. */ if (frag == mag_rte_head->nelems) { - queue *elem, *tmp; - route_head *rte_head; + queue* elem, *tmp; + route_head* rte_head; rte_head = route_head_alloc(); route_add_head(rte_head); @@ -1129,17 +1129,17 @@ mag_rteparse(char *rtemsg) */ QUEUE_FOR_EACH(&mag_rte_head->Q, elem, tmp) { - mag_rte_elem *re = (mag_rte_elem *) elem; - waypoint *waypt; - queue *welem, *wtmp; + mag_rte_elem* re = (mag_rte_elem*) elem; + waypoint* waypt; + queue* welem, *wtmp; /* * Copy route points from temp wpt queue. */ QUEUE_FOR_EACH(&rte_wpt_tmp, welem, wtmp) { - waypt = (waypoint *)welem; + waypt = (waypoint*)welem; if (strcmp(waypt->shortname, re->wpt_name) == 0) { - waypoint * wpt = waypt_dupe(waypt); + waypoint* wpt = waypt_dupe(waypt); route_add_wpt(rte_head, wpt); break; } @@ -1157,10 +1157,10 @@ mag_rteparse(char *rtemsg) } } -const char * -mag_find_descr_from_token(const char *token) +const char* +mag_find_descr_from_token(const char* token) { - icon_mapping_t *i = icon_mapping; + icon_mapping_t* i = icon_mapping; if (icon_mapping == NULL) { return "unknown"; @@ -1177,10 +1177,10 @@ mag_find_descr_from_token(const char *token) return icon_mapping[0].icon; } -const char * -mag_find_token_from_descr(const char *icon) +const char* +mag_find_token_from_descr(const char* icon) { - icon_mapping_t *i = icon_mapping; + icon_mapping_t* i = icon_mapping; if (i == NULL || icon == NULL) { return "a"; @@ -1199,8 +1199,8 @@ mag_find_token_from_descr(const char *icon) * $PMGNWPL,3549.499,N,08650.827,W,0000257,M,HOME,HOME,c*4D * create and return a populated waypoint. */ -static waypoint * -mag_wptparse(char *trkmsg) +static waypoint* +mag_wptparse(char* trkmsg) { double latdeg, lngdeg; char latdir; @@ -1210,10 +1210,10 @@ mag_wptparse(char *trkmsg) char shortname[100]; char descr[256]; char icon_token[100]; - waypoint *waypt; - char *icons; - char *icone; - char *blah; + waypoint* waypt; + char* icons; + char* icone; + char* blah; int i = 0; descr[0] = 0; @@ -1257,7 +1257,7 @@ static void mag_read(void) { if (gpx_vec) { - char **f = os_gpx_files(explorist_info->track_path); + char** f = os_gpx_files(explorist_info->track_path); while (f && *f) { gpx_vec->rd_init(*f); gpx_vec->read(); @@ -1339,17 +1339,17 @@ mag_read(void) static void -mag_waypt_pr(const waypoint *waypointp) +mag_waypt_pr(const waypoint* waypointp) { double lon, lat; double ilon, ilat; int lon_deg, lat_deg; char obuf[200]; char ofmtdesc[200]; - const char *icon_token=NULL; - char *owpt; - char *odesc; - char *isrc = NULL; + const char* icon_token=NULL; + char* owpt; + char* odesc; + char* isrc = NULL; ilat = waypointp->latitude; ilon = waypointp->longitude; @@ -1379,7 +1379,7 @@ mag_waypt_pr(const waypoint *waypointp) isrc = waypointp->notes ? waypointp->notes : waypointp->description; owpt = global_opts.synthesize_shortnames ? mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname; - odesc = isrc ? isrc : (char *)""; + odesc = isrc ? isrc : (char*)""; owpt = mag_cleanse(owpt); if (global_opts.smart_icons && @@ -1421,13 +1421,13 @@ mag_waypt_pr(const waypoint *waypointp) } static -void mag_track_nop(const route_head *rte) +void mag_track_nop(const route_head* rte) { return; } static -void mag_track_disp(const waypoint *waypointp) +void mag_track_disp(const waypoint* waypointp) { double ilon, ilat; double lon, lat; @@ -1436,7 +1436,7 @@ void mag_track_disp(const waypoint *waypointp) int hms=0; int fracsec=0; int date=0; - struct tm *tm = NULL; + struct tm* tm = NULL; ilat = waypointp->latitude; ilon = waypointp->longitude; @@ -1497,14 +1497,14 @@ and to replace the 2nd name with "<<>>", but I haven't seen one of those. */ static void -mag_route_trl(const route_head * rte) +mag_route_trl(const route_head* rte) { - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; char obuff[256]; char buff1[64], buff2[64]; - char *pbuff, *owpt; - const char * icon_token; + char* pbuff, *owpt; + const char* icon_token; int i, numlines, thisline; /* count waypoints for this route */ @@ -1518,7 +1518,7 @@ mag_route_trl(const route_head * rte) thisline = i = 0; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; i++; if (deficon) { @@ -1566,7 +1566,7 @@ mag_route_trl(const route_head * rte) } static void -mag_route_hdr(const route_head *rh) +mag_route_hdr(const route_head* rh) { } @@ -1599,10 +1599,10 @@ mag_write(void) } } -const char ** os_get_magellan_mountpoints() +const char** os_get_magellan_mountpoints() { #if __APPLE__ - const char **dlist = (const char**) xcalloc(2, sizeof *dlist); + const char** dlist = (const char**) xcalloc(2, sizeof *dlist); dlist[0] = xstrdup("/Volumes/Magellan"); dlist[1] = NULL; return dlist; @@ -1613,12 +1613,12 @@ const char ** os_get_magellan_mountpoints() // My kingdom for container classes and portable tree-walking... // Returns a pointer to a static vector that's valid until the next call. -static char ** -os_gpx_files(const char *dirname) +static char** +os_gpx_files(const char* dirname) { #if HAVE_GLOB static glob_t g; - char *path; + char* path; xasprintf(&path, "%s/*.gpx", dirname); glob(path, 0, NULL, &g); xfree(path); diff --git a/gpsbabel/main.c b/gpsbabel/main.c index 552655f06..ce0199ed6 100644 --- a/gpsbabel/main.c +++ b/gpsbabel/main.c @@ -35,28 +35,28 @@ void signal_handler(int sig); typedef struct arg_stack_s { int argn; int argc; - char **argv; - struct arg_stack_s *prev; + char** argv; + struct arg_stack_s* prev; } arg_stack_t; static arg_stack_t -*push_args(arg_stack_t *stack, const int argn, const int argc, char *argv[]) +*push_args(arg_stack_t* stack, const int argn, const int argc, char* argv[]) { - arg_stack_t *res = (arg_stack_t *) xmalloc(sizeof(*res)); + arg_stack_t* res = (arg_stack_t*) xmalloc(sizeof(*res)); res->prev = stack; res->argn = argn; res->argc = argc; - res->argv = (char **)argv; + res->argv = (char**)argv; return res; } static arg_stack_t -*pop_args(arg_stack_t *stack, int *argn, int *argc, char **argv[]) +*pop_args(arg_stack_t* stack, int* argn, int* argc, char** argv[]) { - arg_stack_t *res; - char **argv2 = *argv; + arg_stack_t* res; + char** argv2 = *argv; int i; if (stack == NULL) { @@ -79,12 +79,12 @@ static arg_stack_t } static void -load_args(const char *filename, int *argc, char **argv[]) +load_args(const char* filename, int* argc, char** argv[]) { - gbfile *fin; - char *str, *line = NULL; + gbfile* fin; + char* str, *line = NULL; int argc2; - char **argv2; + char** argv2; fin = gbfopen(filename, "r", "main"); while ((str = gbfgetstr(fin))) { @@ -96,7 +96,7 @@ load_args(const char *filename, int *argc, char **argv[]) if (line == NULL) { line = xstrdup(str); } else { - char *tmp; + char* tmp; xasprintf(&tmp, "%s %s", line, str); xfree(line); line = tmp; @@ -104,13 +104,13 @@ load_args(const char *filename, int *argc, char **argv[]) } gbfclose(fin); - argv2 = (char **) xmalloc(2 * sizeof(*argv2)); + argv2 = (char**) xmalloc(2 * sizeof(*argv2)); argv2[0] = xstrdup(*argv[0]); argc2 = 1; str = csv_lineparse(line, " ", "\"", 0); while (str != NULL) { - argv2 = (char **) xrealloc(argv2, (argc2 + 2) * sizeof(*argv2)); + argv2 = (char**) xrealloc(argv2, (argc2 + 2) * sizeof(*argv2)); argv2[argc2] = xstrdup(str); argc2++; str = csv_lineparse(NULL, " ", "\"", 0); @@ -124,7 +124,7 @@ load_args(const char *filename, int *argc, char **argv[]) } static void -usage(const char *pname, int shorter) +usage(const char* pname, int shorter) { printf("GPSBabel Version %s. http://www.gpsbabel.org\n\n", gpsbabel_version); @@ -179,7 +179,7 @@ usage(const char *pname, int shorter) } static void -spec_usage(const char *vec) +spec_usage(const char* vec) { printf("\n"); disp_vec(vec); @@ -225,24 +225,24 @@ print_extended_info(void) } int -main(int argc, char *argv[]) +main(int argc, char* argv[]) { int c; int argn; - ff_vecs_t *ivecs = NULL; - ff_vecs_t *ovecs = NULL; - filter_vecs_t *fvecs = NULL; - char *fname = NULL; - char *ofname = NULL; - char *ivec_opts = NULL; - char *ovec_opts = NULL; - char *fvec_opts = NULL; + ff_vecs_t* ivecs = NULL; + ff_vecs_t* ovecs = NULL; + filter_vecs_t* fvecs = NULL; + char* fname = NULL; + char* ofname = NULL; + char* ivec_opts = NULL; + char* ovec_opts = NULL; + char* fvec_opts = NULL; int opt_version = 0; int did_something = 0; - const char *prog_name = argv[0]; /* argv is modified during processing */ - queue *wpt_head_bak, *rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */ + const char* prog_name = argv[0]; /* argv is modified during processing */ + queue* wpt_head_bak, *rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */ signed int wpt_ct_bak, rte_ct_bak, trk_ct_bak; /* #ifdef UTF8_SUPPORT */ - arg_stack_t *arg_stack = NULL; + arg_stack_t* arg_stack = NULL; global_opts.objective = wptdata; global_opts.masked_objective = NOTHINGMASK; /* this makes the default mask behaviour slightly different */ @@ -283,7 +283,7 @@ main(int argc, char *argv[]) */ argn = 1; while (argn < argc) { - char *optarg; + char* optarg; if (argv[argn][0] != '-') { break; @@ -685,7 +685,7 @@ main(int argc, char *argv[]) tracking_status.request_terminate = 0; while (!tracking_status.request_terminate) { - waypoint *wpt; + waypoint* wpt; wpt = ivecs->position_ops.rd_position(&tracking_status); diff --git a/gpsbabel/mapasia.c b/gpsbabel/mapasia.c index cdbd6c85e..25ab6c633 100644 --- a/gpsbabel/mapasia.c +++ b/gpsbabel/mapasia.c @@ -46,9 +46,9 @@ #define TR7_S_VALID 28 #define TR7_S_FIX 29 -static gbfile *fin, *fout; -static const waypoint *wpt_tmp; -static const route_head *trk_tmp; +static gbfile* fin, *fout; +static const waypoint* wpt_tmp; +static const route_head* trk_tmp; static int course_tmp, speed_tmp; struct tm tmref; @@ -62,7 +62,7 @@ arglist_t tr7_args[] = { *******************************************************************************/ static void -tr7_rd_init(const char *fname) +tr7_rd_init(const char* fname) { fin = gbfopen_le(fname, "rb", MYNAME); tmref = *gmtime(&gpsbabel_now); @@ -73,9 +73,9 @@ tr7_rd_init(const char *fname) static void tr7_read(void) { - route_head *trk = NULL; + route_head* trk = NULL; unsigned int magic; - waypoint *prev = NULL; + waypoint* prev = NULL; magic = gbfgetint32(fin); if (magic != TR7_TRACK_MAGIC) { @@ -86,7 +86,7 @@ tr7_read(void) unsigned char buff[TR7_S_SIZE]; double lat, lon; struct tm tm; - waypoint *wpt; + waypoint* wpt; float speed, course; gbfread(buff, 1, sizeof(buff), fin); @@ -163,7 +163,7 @@ tr7_read(void) } static void -tr7_check_after_read_head_cb(const route_head *trk) +tr7_check_after_read_head_cb(const route_head* trk) { trk_tmp = trk; course_tmp = 0; @@ -171,7 +171,7 @@ tr7_check_after_read_head_cb(const route_head *trk) } static void -tr7_check_after_read_wpt_cb(const waypoint *wpt) +tr7_check_after_read_wpt_cb(const waypoint* wpt) { if (wpt->speed != 0) { speed_tmp = 1; @@ -182,11 +182,11 @@ tr7_check_after_read_wpt_cb(const waypoint *wpt) } static void -tr7_check_after_read_trailer_cb(const route_head *trk) +tr7_check_after_read_trailer_cb(const route_head* trk) { - queue *elem, *tmp; - QUEUE_FOR_EACH((queue *)&trk->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + queue* elem, *tmp; + QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { + waypoint* wpt = (waypoint*)elem; if (speed_tmp == 0) { WAYPT_UNSET(wpt, speed); } @@ -212,13 +212,13 @@ tr7_rd_deinit(void) *******************************************************************************/ static void -tr7_disp_track_head_cb(const route_head *trk) +tr7_disp_track_head_cb(const route_head* trk) { wpt_tmp = NULL; } static void -tr7_disp_waypt_cb(const waypoint *wpt) +tr7_disp_waypt_cb(const waypoint* wpt) { unsigned char buff[TR7_S_SIZE]; struct tm tm; @@ -274,7 +274,7 @@ tr7_disp_waypt_cb(const waypoint *wpt) } static void -tr7_wr_init(const char *fname) +tr7_wr_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); gbfputint32(TR7_TRACK_MAGIC, fout); @@ -298,7 +298,7 @@ ff_vecs_t mapasia_tr7_vecs = { /* we can read and write tracks */ ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, tr7_rd_init, diff --git a/gpsbabel/mapopolis.c b/gpsbabel/mapopolis.c index 1d3008142..4ff7c7d27 100644 --- a/gpsbabel/mapopolis.c +++ b/gpsbabel/mapopolis.c @@ -63,11 +63,11 @@ struct record { pdb_16 lat2d; }; -static pdbfile *file_in, *file_out; +static pdbfile* file_in, *file_out; static short_handle mkshort_handle; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = pdb_open(fname, MYNAME); } @@ -79,7 +79,7 @@ rd_deinit(void) } static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = pdb_create(fname, MYNAME); mkshort_handle = mkshort_new_handle(); @@ -93,7 +93,7 @@ wr_deinit(void) mkshort_del_handle(&mkshort_handle); } -convert_rec0(struct record0 *rec0) +convert_rec0(struct record0* rec0) { Lon1 = be_read32(&rec0->lon1) / LONDIV; Lat1 = be_read32(&rec0->lat1) / LATDIV; @@ -112,7 +112,7 @@ convert_rec0(struct record0 *rec0) * * Decode the information field * */ void -decode(char *buf) +decode(char* buf) { int i; @@ -124,8 +124,8 @@ decode(char *buf) static void data_read(void) { - struct record *rec; - pdbrec_t *pdb_rec; + struct record* rec; + pdbrec_t* pdb_rec; if ((file_in->creator != MYCREATOR) || (file_in->type != MYTYPE)) { fatal(MYNAME ": Not a Magellan Navigator file.\n"); @@ -136,22 +136,22 @@ data_read(void) // for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) { for (pdb_rec = pdb_rec->next; pdb_rec; pdb_rec=pdb_rec->next) { - waypoint *wpt_tmp; - char *vdata = 0; - char *edata; + waypoint* wpt_tmp; + char* vdata = 0; + char* edata; struct tm tm = {0}; - rec = (struct record *) pdb_rec->data; - edata = (char *) rec + pdb_rec->size; + rec = (struct record*) pdb_rec->data; + edata = (char*) rec + pdb_rec->size; - for (; vdata < edata; rec = (struct record *) vdata) { + for (; vdata < edata; rec = (struct record*) vdata) { wpt_tmp = waypt_new(); wpt_tmp->latitude = Lat1 + be_read16(&rec->lat1d) / LATDIV2; wpt_tmp->longitude = Lon1 + be_read16(&rec->lon1d) / LONDIV2; - vdata = (char *) rec + sizeof(*rec); + vdata = (char*) rec + sizeof(*rec); wpt_tmp->description = xstrdup(vdata); vdata += strlen(wpt_tmp->description) + 1 + 6; @@ -169,15 +169,15 @@ data_read(void) static void -my_writewpt(const waypoint *wpt) +my_writewpt(const waypoint* wpt) { #if 0 - struct record *rec; + struct record* rec; static int ct; - struct tm *tm; - char *vdata; + struct tm* tm; + char* vdata; time_t tm_t; - const char *sn = global_opts.synthesize_shortnames ? + const char* sn = global_opts.synthesize_shortnames ? mkshort(mkshort_handle, wpt->description) : wpt->shortname; @@ -217,7 +217,7 @@ my_writewpt(const waypoint *wpt) rec->plot = 0; rec->unknown3 = 'a'; - vdata = (char *)rec + sizeof(*rec); + vdata = (char*)rec + sizeof(*rec); if (sn) { strncpy(vdata, sn, 21); vdata[20] = '\0'; @@ -236,7 +236,7 @@ my_writewpt(const waypoint *wpt) vdata[1] = '\0'; vdata += 2; - pdb_write(file_out, 0, rec, (char *)vdata - (char *)rec); + pdb_write(file_out, 0, rec, (char*)vdata - (char*)rec); xfree(rec); #endif @@ -245,7 +245,7 @@ my_writewpt(const waypoint *wpt) static void data_write(void) { - static char *appinfo = + static char* appinfo = "\0\x01" "User\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -273,7 +273,7 @@ data_write(void) file_out->type = MYTYPE; /* CWpt */ file_out->creator = MYCREATOR; /* cGPS */ file_out->version = 1; - file_out->appinfo = (void *)appinfo; + file_out->appinfo = (void*)appinfo; file_out->appinfo_len = 276; waypt_disp_all(my_writewpt); diff --git a/gpsbabel/mapsend.c b/gpsbabel/mapsend.c index 0b9797223..ea1bfe3c8 100644 --- a/gpsbabel/mapsend.c +++ b/gpsbabel/mapsend.c @@ -25,8 +25,8 @@ #include "mapsend.h" #include "magellan.h" -static gbfile *mapsend_file_in; -static gbfile *mapsend_file_out; +static gbfile* mapsend_file_in; +static gbfile* mapsend_file_out; static short_handle mkshort_handle; static short_handle wpt_handle; @@ -36,7 +36,7 @@ static int trk_version = 30; #define MYNAME "mapsend" -static char *mapsend_opt_trkver = NULL; +static char* mapsend_opt_trkver = NULL; #define MAPSEND_TRKVER_MIN 3 #define MAPSEND_TRKVER_MAX 4 @@ -72,7 +72,7 @@ mapsend_init_opts(const char isReading) /* 1=read, 2=write */ } static void -mapsend_rd_init(const char *fname) +mapsend_rd_init(const char* fname) { mapsend_init_opts(1); mapsend_file_in = gbfopen_le(fname, "rb", MYNAME); @@ -85,7 +85,7 @@ mapsend_rd_deinit(void) } static void -mapsend_wr_init(const char *fname) +mapsend_wr_init(const char* fname) { mapsend_init_opts(0); mapsend_file_out = gbfopen(fname, "wb", MYNAME); @@ -114,8 +114,8 @@ mapsend_wpt_read(void) int wpt_number; char wpt_icon; char wpt_status; - waypoint *wpt_tmp; - route_head *rte_head; + waypoint* wpt_tmp; + route_head* rte_head; wpt_count = gbfgetint32(mapsend_file_in); @@ -191,8 +191,8 @@ mapsend_track_read(void) unsigned int trk_count; int valid; unsigned char centisecs; - route_head *track_head; - waypoint *wpt_tmp; + route_head* track_head; + waypoint* wpt_tmp; track_head = route_head_alloc(); track_head->rte_name = gbfgetpstr(mapsend_file_in); @@ -268,16 +268,16 @@ mapsend_read(void) static void -mapsend_waypt_pr(const waypoint *waypointp) +mapsend_waypt_pr(const waypoint* waypointp) { unsigned char c; double falt; static int cnt = 0; - const char *iconp = NULL; - const char *sn = global_opts.synthesize_shortnames ? + const char* iconp = NULL; + const char* sn = global_opts.synthesize_shortnames ? mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname; - char *tmp; + char* tmp; /* * The format spec doesn't call out the character set of waypoint @@ -350,9 +350,9 @@ mapsend_waypt_pr(const waypoint *waypointp) } static void -mapsend_route_hdr(const route_head *rte) +mapsend_route_hdr(const route_head* rte) { - char * rname; + char* rname; /* route name -- mapsend really seems to want something here.. */ if (!rte->rte_name) { @@ -372,16 +372,16 @@ mapsend_route_hdr(const route_head *rte) } static void -mapsend_noop(const route_head *wp) +mapsend_noop(const route_head* wp) { /* no-op */ } static void -mapsend_route_disp(const waypoint *waypointp) +mapsend_route_disp(const waypoint* waypointp) { unsigned char c; - const char *iconp; + const char* iconp; route_wp_count++; @@ -409,15 +409,15 @@ mapsend_route_disp(const waypoint *waypointp) gbfwrite(&c, 1, 1, mapsend_file_out); } -void mapsend_track_hdr(const route_head * trk) +void mapsend_track_hdr(const route_head* trk) { /* * we write mapsend v3.0 tracks as mapsend v2.0 tracks get * tremendously out of whack time/date wise. */ - char *verstring = "30"; - queue *elem, *tmp; - char *tname; + char* verstring = "30"; + queue* elem, *tmp; + char* tname; int i; mapsend_hdr hdr = {13, "4D533334 MS", "30", ms_type_track, {0, 0, 0}}; @@ -466,7 +466,7 @@ void mapsend_track_hdr(const route_head * trk) } -void mapsend_track_disp(const waypoint * wpt) +void mapsend_track_disp(const waypoint* wpt) { unsigned char c; int t; diff --git a/gpsbabel/mapsource.c b/gpsbabel/mapsource.c index 182939a28..e096b06dc 100644 --- a/gpsbabel/mapsource.c +++ b/gpsbabel/mapsource.c @@ -29,9 +29,9 @@ #include "jeeps/gpsmath.h" #include -static gbfile *mps_file_in; -static gbfile *mps_file_out; -static gbfile *mps_file_temp; +static gbfile* mps_file_in; +static gbfile* mps_file_out; +static gbfile* mps_file_temp; static short_handle mkshort_handle; static int mps_ver_in = 0; @@ -39,10 +39,10 @@ static int mps_ver_out = 0; static int mps_ver_temp = 0; /* Temporary pathname used when merging gpsbabel output with an existing file */ -static char *tempname; -static char *fin_name; +static char* tempname; +static char* fin_name; -static const waypoint *prevRouteWpt; +static const waypoint* prevRouteWpt; /* Private queues of written out waypoints */ static queue written_wpt_head; static queue written_route_wpt_head; @@ -67,13 +67,13 @@ static short_handle read_route_wpt_mkshort_handle; #define MPSDESCBUFFERLEN 4096 -char *snlen = NULL; -char *snwhiteopt = NULL; -char *mpsverout = NULL; -char *mpsmergeouts = NULL; +char* snlen = NULL; +char* snwhiteopt = NULL; +char* mpsverout = NULL; +char* mpsmergeouts = NULL; int mpsmergeout; -char *mpsusedepth = NULL; -char *mpsuseprox = NULL; +char* mpsusedepth = NULL; +char* mpsuseprox = NULL; static arglist_t mps_args[] = { @@ -105,24 +105,24 @@ arglist_t mps_args[] = { }; static void -mps_noop(const route_head *wp) +mps_noop(const route_head* wp) { /* no-op */ } void -mps_wpt_q_init(queue *whichQueue) +mps_wpt_q_init(queue* whichQueue) { QUEUE_INIT(whichQueue); } void -mps_wpt_q_deinit(queue *whichQueue) +mps_wpt_q_deinit(queue* whichQueue) { - queue *elem, *tmp; + queue* elem, *tmp; QUEUE_FOR_EACH(whichQueue, elem, tmp) { - waypoint *q = (waypoint *) dequeue(elem); + waypoint* q = (waypoint*) dequeue(elem); waypt_free(q); } } @@ -131,14 +131,14 @@ mps_wpt_q_deinit(queue *whichQueue) * Find a waypoint that we've already written out * */ -waypoint * -mps_find_wpt_q_by_name(const queue *whichQueue, const char *name) +waypoint* +mps_find_wpt_q_by_name(const queue* whichQueue, const char* name) { - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; QUEUE_FOR_EACH(whichQueue, elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; if (0 == strcmp(waypointp->shortname, name)) { return waypointp; } @@ -151,9 +151,9 @@ mps_find_wpt_q_by_name(const queue *whichQueue, const char *name) * */ void -mps_wpt_q_add(const queue *whichQueue, const waypoint *wpt) +mps_wpt_q_add(const queue* whichQueue, const waypoint* wpt) { - waypoint *written_wpt = waypt_dupe(wpt); + waypoint* written_wpt = waypt_dupe(wpt); ENQUEUE_TAIL(whichQueue, &written_wpt->Q); } @@ -224,7 +224,7 @@ mps_converted_icon_number(const int icon_num, const int mpsver, garmin_formats_e } static void -mps_rd_init(const char *fname) +mps_rd_init(const char* fname) { mps_file_in = gbfopen_le(fname, "rb", MYNAME); @@ -245,7 +245,7 @@ mps_rd_deinit(void) } static void -mps_wr_init(const char *fname) +mps_wr_init(const char* fname) { fin_name = xstrdup(fname); if (mpsmergeouts) { @@ -309,7 +309,7 @@ mps_wr_deinit(void) * and write into buf. */ static void -mps_readstr(gbfile *mps_file, char *buf, size_t sz) +mps_readstr(gbfile* mps_file, char* buf, size_t sz) { int c; while (sz-- && (c = gbfgetc(mps_file)) != EOF) { @@ -325,7 +325,7 @@ mps_readstr(gbfile *mps_file, char *buf, size_t sz) * MRCB */ static void -mps_fileHeader_r(gbfile *mps_file, int *mps_ver) +mps_fileHeader_r(gbfile* mps_file, int* mps_ver) { char hdr[100]; int reclen; @@ -366,7 +366,7 @@ mps_fileHeader_r(gbfile *mps_file, int *mps_ver) * MRCB */ static void -mps_fileHeader_w(gbfile *mps_file, int mps_ver) +mps_fileHeader_w(gbfile* mps_file, int mps_ver) { char hdr[100]; int reclen; @@ -425,7 +425,7 @@ mps_fileHeader_w(gbfile *mps_file, int mps_ver) * MRCB */ static void -mps_mapsegment_r(gbfile *mps_file, int mps_ver) +mps_mapsegment_r(gbfile* mps_file, int mps_ver) { int reclen; @@ -460,7 +460,7 @@ mps_mapsegment_r(gbfile *mps_file, int mps_ver) * MRCB */ static void -mps_mapsetname_r(gbfile *mps_file, int mps_ver) +mps_mapsetname_r(gbfile* mps_file, int mps_ver) { int reclen; @@ -485,7 +485,7 @@ mps_mapsetname_r(gbfile *mps_file, int mps_ver) * MRCB */ static void -mps_mapsetname_w(gbfile *mps_file, int mps_ver) +mps_mapsetname_w(gbfile* mps_file, int mps_ver) { char hdr[100]; int reclen; @@ -504,18 +504,18 @@ mps_mapsetname_w(gbfile *mps_file, int mps_ver) * MRCB */ static void -mps_waypoint_r(gbfile *mps_file, int mps_ver, waypoint **wpt, unsigned int *mpsclass) +mps_waypoint_r(gbfile* mps_file, int mps_ver, waypoint** wpt, unsigned int* mpsclass) { char tbuf[100]; char wptname[MPSNAMEBUFFERLEN]; - char *wptdesc = NULL; - char *wptnotes = NULL; + char* wptdesc = NULL; + char* wptnotes = NULL; int lat; int lon; int icon; int dynamic; - waypoint *thisWaypoint = NULL; + waypoint* thisWaypoint = NULL; double mps_altitude = unknown_alt; double mps_proximity = unknown_alt; double mps_depth = unknown_alt; @@ -606,14 +606,14 @@ mps_waypoint_r(gbfile *mps_file, int mps_ver, waypoint **wpt, unsigned int *mpsc * MRCB */ static void -mps_waypoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt, const int isRouteWpt) +mps_waypoint_w(gbfile* mps_file, int mps_ver, const waypoint* wpt, const int isRouteWpt) { int reclen; int lat, lon; int icon; - char *src = ""; /* default to empty string */ - char *ident; - char *ascii_description; + char* src = ""; /* default to empty string */ + char* ident; + char* ascii_description; char zbuf[25]; char ffbuf[25]; int display = 1; @@ -755,9 +755,9 @@ mps_waypoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt, const int isR * */ static void -mps_waypoint_w_unique_wrapper(const waypoint *wpt) +mps_waypoint_w_unique_wrapper(const waypoint* wpt) { - waypoint *wptfound = NULL; + waypoint* wptfound = NULL; /* Search for this waypoint in the ones already written */ wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname); @@ -785,9 +785,9 @@ mps_waypoint_w_unique_wrapper(const waypoint *wpt) * */ static void -mps_route_wpt_w_unique_wrapper(const waypoint *wpt) +mps_route_wpt_w_unique_wrapper(const waypoint* wpt) { - waypoint *wptfound = NULL; + waypoint* wptfound = NULL; /* Search for this waypoint in the ones already written */ wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname); @@ -824,10 +824,10 @@ mps_route_wpt_w_unique_wrapper(const waypoint *wpt) * */ static void -mps_waypoint_w_uniqloc_wrapper(waypoint *wpt) +mps_waypoint_w_uniqloc_wrapper(waypoint* wpt) { - waypoint *wptfound = NULL; - char *newName; + waypoint* wptfound = NULL; + char* newName; /* Search for this waypoint in the ones already written */ wptfound = mps_find_wpt_q_by_name(&written_wpt_head, wpt->shortname); @@ -866,10 +866,10 @@ mps_waypoint_w_uniqloc_wrapper(waypoint *wpt) * MRCB */ static void -mps_route_r(gbfile *mps_file, int mps_ver, route_head **rte) +mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) { char tbuf[100]; - char *rtename; + char* rtename; char wptname[MPSNAMEBUFFERLEN]; int lat = 0; int lon = 0; @@ -878,11 +878,11 @@ mps_route_r(gbfile *mps_file, int mps_ver, route_head **rte) int thisInterlinkStep; unsigned int mpsclass; - route_head *rte_head; + route_head* rte_head; int rte_count; - waypoint *thisWaypoint; - waypoint *tempWpt; + waypoint* thisWaypoint; + waypoint* tempWpt; double mps_altitude = unknown_alt; double mps_depth = unknown_alt; @@ -1111,18 +1111,18 @@ mps_route_r(gbfile *mps_file, int mps_ver, route_head **rte) * MRCB */ static void -mps_routehdr_w(gbfile *mps_file, int mps_ver, const route_head *rte) +mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte) { unsigned int reclen; unsigned int rte_datapoints; int rname_len; - char *rname; + char* rname; char hdr[20]; char zbuf[20]; - char *src = ""; - char *ident; + char* src = ""; + char* ident; - waypoint *testwpt; + waypoint* testwpt; time_t uniqueValue = 0; int allWptNameLengths; @@ -1136,7 +1136,7 @@ mps_routehdr_w(gbfile *mps_file, int mps_ver, const route_head *rte) int lat; int lon; - queue *elem, *tmp; + queue* elem, *tmp; prevRouteWpt = NULL; /* clear the stateful flag used to know when the start of route wpts happens */ @@ -1148,7 +1148,7 @@ mps_routehdr_w(gbfile *mps_file, int mps_ver, const route_head *rte) if (rte->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid route - treat as a placeholder for now */ QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - testwpt = (waypoint *)elem; + testwpt = (waypoint*)elem; if (rte_datapoints == 0) { uniqueValue = testwpt->creation_time; } @@ -1266,7 +1266,7 @@ mps_routehdr_w(gbfile *mps_file, int mps_ver, const route_head *rte) } static void -mps_routehdr_w_wrapper(const route_head *rte) +mps_routehdr_w_wrapper(const route_head* rte) { mps_routehdr_w(mps_file_out, mps_ver_out, rte); } @@ -1277,14 +1277,14 @@ mps_routehdr_w_wrapper(const route_head *rte) * MRCB */ static void -mps_routedatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *rtewpt) +mps_routedatapoint_w(gbfile* mps_file, int mps_ver, const waypoint* rtewpt) { int lat; int lon; char zbuf[20]; char ffbuf[20]; - char *src = ""; - char *ident; + char* src = ""; + char* ident; int reclen; int maxlat; @@ -1295,7 +1295,7 @@ mps_routedatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *rtewpt) double minalt=-unknown_alt; double mps_altitude; - waypoint *wptfound; + waypoint* wptfound; memset(zbuf, 0, sizeof(zbuf)); memset(ffbuf, 0xff, sizeof(ffbuf)); @@ -1442,7 +1442,7 @@ mps_routedatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *rtewpt) } static void -mps_routedatapoint_w_wrapper(const waypoint *rte) +mps_routedatapoint_w_wrapper(const waypoint* rte) { mps_routedatapoint_w(mps_file_out, mps_ver_out, rte); } @@ -1453,7 +1453,7 @@ mps_routedatapoint_w_wrapper(const waypoint *rte) * MRCB */ static void -mps_routetrlr_w(gbfile *mps_file, int mps_ver, const route_head *rte) +mps_routetrlr_w(gbfile* mps_file, int mps_ver, const route_head* rte) { char hdr[2]; int value = 0; @@ -1467,7 +1467,7 @@ mps_routetrlr_w(gbfile *mps_file, int mps_ver, const route_head *rte) } static void -mps_routetrlr_w_wrapper(const route_head *rte) +mps_routetrlr_w_wrapper(const route_head* rte) { mps_routetrlr_w(mps_file_out, mps_ver_out, rte); } @@ -1478,17 +1478,17 @@ mps_routetrlr_w_wrapper(const route_head *rte) * MRCB */ static void -mps_track_r(gbfile *mps_file, int mps_ver, route_head **trk) +mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk) { - char *trkname; + char* trkname; int lat; int lon; int dateTime = 0; - route_head *track_head; + route_head* track_head; int trk_count; - waypoint *thisWaypoint; + waypoint* thisWaypoint; double mps_altitude = unknown_alt; double mps_depth = unknown_alt; @@ -1565,25 +1565,25 @@ mps_track_r(gbfile *mps_file, int mps_ver, route_head **trk) * MRCB */ static void -mps_trackhdr_w(gbfile *mps_file, int mps_ver, const route_head *trk) +mps_trackhdr_w(gbfile* mps_file, int mps_ver, const route_head* trk) { unsigned int reclen; unsigned int trk_datapoints; unsigned int colour = 0; /* unknown colour */ int tname_len; - char *tname; + char* tname; char hdr[20]; - waypoint *testwpt; + waypoint* testwpt; time_t uniqueValue = 0; - queue *elem, *tmp; + queue* elem, *tmp; /* total nodes (waypoints) this track */ trk_datapoints = 0; if (trk->waypoint_list.next) { /* this test doesn't do what I want i.e test if this is a valid track - treat as a placeholder for now */ QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) { if (trk_datapoints == 0) { - testwpt = (waypoint *)elem; + testwpt = (waypoint*)elem; uniqueValue = testwpt->creation_time; } trk_datapoints++; @@ -1625,7 +1625,7 @@ mps_trackhdr_w(gbfile *mps_file, int mps_ver, const route_head *trk) } static void -mps_trackhdr_w_wrapper(const route_head *trk) +mps_trackhdr_w_wrapper(const route_head* trk) { mps_trackhdr_w(mps_file_out, mps_ver_out, trk); } @@ -1636,7 +1636,7 @@ mps_trackhdr_w_wrapper(const route_head *trk) * MRCB */ static void -mps_trackdatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt) +mps_trackdatapoint_w(gbfile* mps_file, int mps_ver, const waypoint* wpt) { int lat, lon; time_t t = wpt->creation_time; @@ -1679,7 +1679,7 @@ mps_trackdatapoint_w(gbfile *mps_file, int mps_ver, const waypoint *wpt) } static void -mps_trackdatapoint_w_wrapper(const waypoint *wpt) +mps_trackdatapoint_w_wrapper(const waypoint* wpt) { mps_trackdatapoint_w(mps_file_out, mps_ver_out, wpt); } @@ -1688,9 +1688,9 @@ mps_trackdatapoint_w_wrapper(const waypoint *wpt) static void mps_read(void) { - waypoint *wpt; - route_head *rte; - route_head *trk; + waypoint* wpt; + route_head* rte; + route_head* trk; char recType; int reclen; @@ -1813,9 +1813,9 @@ void mps_write(void) { int short_length; - waypoint *wpt; - route_head *rte; - route_head *trk; + waypoint* wpt; + route_head* rte; + route_head* trk; char recType; int reclen; @@ -1847,7 +1847,7 @@ mps_write(void) fatal(MYNAME ": merge source version is %d, requested out version is %d\n", mps_ver_temp, atoi(mpsverout)); } } else { - mpsverout = (char *) xmalloc(10); + mpsverout = (char*) xmalloc(10); sprintf(mpsverout,"%d", mps_ver_temp); } } diff --git a/gpsbabel/mkicondoc.c b/gpsbabel/mkicondoc.c index b38ad6850..75557ee29 100644 --- a/gpsbabel/mkicondoc.c +++ b/gpsbabel/mkicondoc.c @@ -11,12 +11,12 @@ tbl_ent(int n, ...) { int i; - char *t; + char* t; va_list args; va_start(args, n); #if 0 for (i = 0; i < n; i++) { - t = va_arg(args, char *); + t = va_arg(args, char*); printf("%s%s", i > 0 ? "," : "", t); } @@ -31,16 +31,16 @@ tbl_ent(int n, ...) } #include "garmin_tables.c" -sort_garmin(const void *a, const void *b) +sort_garmin(const void* a, const void* b) { - const icon_mapping_t *ap = a; - const icon_mapping_t *bp = b; + const icon_mapping_t* ap = a; + const icon_mapping_t* bp = b; return (case_ignore_strcmp((ap)->icon, (bp)->icon)); } garmin() { - icon_mapping_t *i; + icon_mapping_t* i; int n = 0; char pbuf[100]; char mbuf[100]; diff --git a/gpsbabel/mkshort.c b/gpsbabel/mkshort.c index 2d715bf68..20ed57548 100644 --- a/gpsbabel/mkshort.c +++ b/gpsbabel/mkshort.c @@ -32,7 +32,7 @@ static const char vowels[] = "aeiouAEIOU"; #define DEFAULT_TARGET_LEN 8 -static const char *DEFAULT_BADCHARS = "\"$.,'!-"; +static const char* DEFAULT_BADCHARS = "\"$.,'!-"; /* * Hash table tunings. The reality is that our hash doesn't have to be @@ -44,13 +44,13 @@ static const char *DEFAULT_BADCHARS = "\"$.,'!-"; typedef struct { queue list; - char *orig_shortname; + char* orig_shortname; int conflictctr; } uniq_shortname; static struct replacements { - const char *orig; - const char *replacement; + const char* orig; + const char* replacement; } replacements[] = { {"zero", "0"}, {"one", "1"}, @@ -68,7 +68,7 @@ static struct replacements { /* * We hash all strings as upper case. */ -unsigned int hash_string(const char *key) +unsigned int hash_string(const char* key) { unsigned int hash = 0; while (*key) { @@ -86,7 +86,7 @@ mkshort_new_handle() #endif { int i; - mkshort_handle_imp *h = (mkshort_handle_imp *) xxcalloc(sizeof *h, 1, file, line); + mkshort_handle_imp* h = (mkshort_handle_imp*) xxcalloc(sizeof *h, 1, file, line); for (i = 0; i < PRIME; i++) { QUEUE_INIT(&h->namelist[i]); @@ -103,37 +103,37 @@ mkshort_new_handle() } static -uniq_shortname * -is_unique(mkshort_handle_imp *h, char *name) +uniq_shortname* +is_unique(mkshort_handle_imp* h, char* name) { - queue *e, *t; + queue* e, *t; int hash; hash = hash_string(name); QUEUE_FOR_EACH(&h->namelist[hash], e, t) { - uniq_shortname *z = (uniq_shortname *) e; + uniq_shortname* z = (uniq_shortname*) e; if (0 == case_ignore_strcmp(z->orig_shortname, name)) { return z; } } - return (uniq_shortname *) NULL; + return (uniq_shortname*) NULL; } static void -add_to_hashlist(mkshort_handle_imp *h, char *name) +add_to_hashlist(mkshort_handle_imp* h, char* name) { int hash = hash_string(name); - uniq_shortname *s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname)); + uniq_shortname* s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname)); s->orig_shortname = xstrdup(name); ENQUEUE_TAIL(&h->namelist[hash], &s->list); } -char * -mkshort_add_to_list(mkshort_handle_imp *h, char *name) +char* +mkshort_add_to_list(mkshort_handle_imp* h, char* name) { - uniq_shortname *s; + uniq_shortname* s; while ((s = is_unique(h, name))) { int dl; @@ -145,7 +145,7 @@ mkshort_add_to_list(mkshort_handle_imp *h, char *name) dl = sprintf(tbuf, ".%d", s->conflictctr); if (l + dl < h->target_len) { - name = (char *) xrealloc(name, l + dl + 1); + name = (char*) xrealloc(name, l + dl + 1); strcat(name, tbuf); } else { strcpy(&name[l-dl], tbuf); @@ -157,9 +157,9 @@ mkshort_add_to_list(mkshort_handle_imp *h, char *name) } void -mkshort_del_handle(short_handle *h) +mkshort_del_handle(short_handle* h) { - mkshort_handle_imp *hdr = (mkshort_handle_imp*) *h; + mkshort_handle_imp* hdr = (mkshort_handle_imp*) *h; int i; if (!h || !hdr) { @@ -167,9 +167,9 @@ mkshort_del_handle(short_handle *h) } for (i = 0; i < PRIME; i++) { - queue *e, *t; + queue* e, *t; QUEUE_FOR_EACH(&hdr->namelist[i], e, t) { - uniq_shortname *s = (uniq_shortname *) e; + uniq_shortname* s = (uniq_shortname*) e; #if 0 if (global_opts.verbose_status >= 2 && s->conflictctr) { fprintf(stderr, "%d Output name conflicts: '%s'\n", @@ -199,8 +199,8 @@ mkshort_del_handle(short_handle *h) */ static -char * -delete_last_vowel(int start, char *istring, int *replaced) +char* +delete_last_vowel(int start, char* istring, int* replaced) { int l; @@ -210,7 +210,7 @@ delete_last_vowel(int start, char *istring, int *replaced) *replaced = 0; for (l = strlen(istring); l > start; l--) { if (strchr(vowels, istring[l-1])) { - char *ostring; + char* ostring; /* If vowel is the first letter of a word, keep it.*/ if (istring[l-2] == ' ') { continue; @@ -232,9 +232,9 @@ delete_last_vowel(int start, char *istring, int *replaced) * are made only at the end of the string. */ void -replace_constants(char *s) +replace_constants(char* s) { - struct replacements *r; + struct replacements* r; int origslen = strlen(s); for (r = replacements; r->orig; r++) { @@ -260,7 +260,7 @@ replace_constants(char *s) void setshort_length(short_handle h, int l) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; if (l == 0) { hdl->target_len = DEFAULT_TARGET_LEN; } else { @@ -275,7 +275,7 @@ setshort_length(short_handle h, int l) void setshort_whitespace_ok(short_handle h, int l) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; hdl->whitespaceok = l; } @@ -287,7 +287,7 @@ setshort_whitespace_ok(short_handle h, int l) void setshort_repeating_whitespace_ok(short_handle h, int l) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; hdl->repeating_whitespaceok = l; } @@ -296,9 +296,9 @@ setshort_repeating_whitespace_ok(short_handle h, int l) * becuase it was filtered by charsets or null or whatever. */ void -setshort_defname(short_handle h, const char *s) +setshort_defname(short_handle h, const char* s) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; if (s == NULL) { fatal("setshort_defname called without a valid name."); } @@ -314,9 +314,9 @@ setshort_defname(short_handle h, const char *s) * resets to default. */ void -setshort_badchars(short_handle h, const char *s) +setshort_badchars(short_handle h, const char* s) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; if ((hdl->badchars != NULL)) { xfree(hdl->badchars); @@ -329,9 +329,9 @@ setshort_badchars(short_handle h, const char *s) * in generated names. */ void -setshort_goodchars(short_handle h, const char *s) +setshort_goodchars(short_handle h, const char* s) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; if (hdl->goodchars != NULL) { xfree(hdl->goodchars); @@ -349,7 +349,7 @@ setshort_goodchars(short_handle h, const char *s) void setshort_mustupper(short_handle h, int i) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; hdl->mustupper = i; } @@ -361,7 +361,7 @@ setshort_mustupper(short_handle h, int i) void setshort_mustuniq(short_handle h, int i) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; hdl->must_uniq = i; } @@ -371,24 +371,24 @@ setshort_mustuniq(short_handle h, int i) void setshort_is_utf8(short_handle h, const int is_utf8) { - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; hdl->is_utf8 = is_utf8; } -char * +char* #ifdef DEBUG_MEM -MKSHORT(short_handle h, const char *istring, DEBUG_PARAMS) +MKSHORT(short_handle h, const char* istring, DEBUG_PARAMS) #else -mkshort(short_handle h, const char *istring) +mkshort(short_handle h, const char* istring) #endif { - char *ostring; - char *nstring; - char *tstring; - char *cp; - char *np; + char* ostring; + char* nstring; + char* tstring; + char* cp; + char* np; int i, l, nlen, replaced; - mkshort_handle_imp *hdl = (mkshort_handle_imp *) h; + mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; if (hdl->is_utf8) { ostring = cet_utf8_strdup(istring); /* clean UTF-8 string */ @@ -544,12 +544,12 @@ mkshort(short_handle h, const char *istring) if (hdl->is_utf8) { /* ToDo: Keep trailing numeric data as described above! */ if (cet_utf8_strlen(ostring) > hdl->target_len) { - char *tmp = cet_utf8_strndup(ostring, hdl->target_len); + char* tmp = cet_utf8_strndup(ostring, hdl->target_len); xfree(ostring); ostring = tmp; } } else if ((/*i = */strlen(ostring)) > hdl->target_len) { - char *dp = &ostring[hdl->target_len] - strlen(np); + char* dp = &ostring[hdl->target_len] - strlen(np); if (dp < ostring) { dp = ostring; } @@ -577,8 +577,8 @@ mkshort(short_handle h, const char *istring) * As above, but arg list is a waypoint so we can centralize * the code that considers the alternate sources. */ -char * -mkshort_from_wpt(short_handle h, const waypoint *wpt) +char* +mkshort_from_wpt(short_handle h, const waypoint* wpt) { /* This probably came from a Groundspeak Pocket Query * so use the 'cache name' instead of the description field @@ -607,7 +607,7 @@ mkshort_from_wpt(short_handle h, const waypoint *wpt) #if 0 -char *foo[] = { +char* foo[] = { "VwthPst# 3700.706N 08627.588W 0000000m View the Past #2 ", "PilotRoc 3655.270N 08717.173W 0000000m Pilot Rock by CacheAdvance ", "MrCycsNg 3652.407N 08728.890W 0000000m Mr. Cayces Neighborhood by Ca", @@ -755,7 +755,7 @@ char *foo[] = { main() { - char **foop = foo; + char** foop = foo; int r; printf("%s\n", mkshort("The Troll")); diff --git a/gpsbabel/mmo.c b/gpsbabel/mmo.c index 32c02f177..fd6184028 100644 --- a/gpsbabel/mmo.c +++ b/gpsbabel/mmo.c @@ -52,7 +52,7 @@ // #define MMO_DBG -static char *opt_locked, *opt_visible, *opt_version; +static char* opt_locked, *opt_visible, *opt_version; static arglist_t mmo_args[] = { @@ -73,21 +73,21 @@ arglist_t mmo_args[] = { typedef struct mmo_data_s { int objid; /* internal object id */ - char *name; - const char *category; /* currently not handled */ + char* name; + const char* category; /* currently not handled */ gpsdata_type type; /* type of "data" */ time_t ctime; time_t mtime; int left; /* number of un-readed route points */ - void *data; /* can be a waypoint, a route or a track */ + void* data; /* can be a waypoint, a route or a track */ int refct; - struct mmo_data_s **members; + struct mmo_data_s** members; unsigned char visible:1; unsigned char locked:1; unsigned char loaded:1; } mmo_data_t; -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int mmo_version; static int mmo_obj_ct; static int mmo_object_id; @@ -100,14 +100,14 @@ static gbuint16 ico_object_id; static gbuint16 pos_object_id; static gbuint16 txt_object_id; static gpsdata_type mmo_datatype; -static route_head *mmo_rte; +static route_head* mmo_rte; -static avltree_t *category_names, *objects, *mmobjects, *category_ids; -static avltree_t *icons; +static avltree_t* category_names, *objects, *mmobjects, *category_ids; +static avltree_t* icons; typedef struct mmo_icon_mapping_s { const int value; - const char *icon; + const char* icon; } mmo_icon_mapping_t; /* standard icons; no bitmaps in file */ @@ -151,7 +151,7 @@ static const gbuint32 obj_type_wpt = 0x3C; #ifdef MMO_DBG static void -dbgprintf(const char *sobj, const char *fmt, ...) +dbgprintf(const char* sobj, const char* fmt, ...) { va_list args; va_start(args, fmt); @@ -166,10 +166,10 @@ dbgprintf(const char *sobj, const char *fmt, ...) # define DBG(args) do {} while (0) ; #endif -static char * +static char* mmo_readstr(void) { - char *res; + char* res; int len; len = (unsigned)gbfgetc(fin); @@ -179,7 +179,7 @@ mmo_readstr(void) fatal(MYNAME ": Invalid string length (%d)!\n", len); } } - res = xmalloc(len + 1); + res = (char*) xmalloc(len + 1); res[len] = '\0'; if (len) { gbfread(res, len, 1, fin); @@ -193,7 +193,7 @@ mmo_readstr(void) static int -mmo_fillbuf2(void *buf, const gbsize_t bufsz, const gbsize_t count, const int need_all) +mmo_fillbuf2(void* buf, const gbsize_t bufsz, const gbsize_t count, const int need_all) { gbsize_t res; @@ -212,7 +212,7 @@ mmo_fillbuf2(void *buf, const gbsize_t bufsz, const gbsize_t count, const int ne #define mmo_fillbuf(a,b,c) mmo_fillbuf2((a),sizeof((a)),(b),(c)) static void -mmo_printbuf(const char *buf, int count, const char *comment) +mmo_printbuf(const char* buf, int count, const char* comment) { #ifdef MMO_DBG int i; @@ -234,14 +234,14 @@ mmo_printbuf(const char *buf, int count, const char *comment) /******************************************************************************/ -static mmo_data_t * -mmo_register_object(const int objid, const void *ptr, const gpsdata_type type) +static mmo_data_t* +mmo_register_object(const int objid, const void* ptr, const gpsdata_type type) { char key[16]; - mmo_data_t *data; + mmo_data_t* data; - data = xcalloc(1, sizeof(*data)); - data->data = (void *)ptr; + data = (mmo_data_t*) xcalloc(1, sizeof(*data)); + data->data = (void*)ptr; data->visible = 1; data->locked = 0; data->type = type; @@ -255,29 +255,29 @@ mmo_register_object(const int objid, const void *ptr, const gpsdata_type type) static int -mmo_get_objid(const void *ptr) +mmo_get_objid(const void* ptr) { - const char *key; - mmo_data_t *data; + const char* key; + mmo_data_t* data; - if ((key = avltree_first(objects, (void *)&data))) do { + if ((key = avltree_first(objects, (const void**)&data))) do { if (data->data == ptr) { return atoi(key); } - } while ((key = avltree_next(objects, key, (void *)&data))); + } while ((key = avltree_next(objects, key, (const void**)&data))); return 0; } -static mmo_data_t * +static mmo_data_t* mmo_get_object(const gbuint16 objid) { char key[16]; - mmo_data_t *data; + mmo_data_t* data; snprintf(key, sizeof(key), "%d", objid | 0x8000); - if (! avltree_find(objects, key, (void *)&data)) { + if (! avltree_find(objects, key, (const void**)&data)) { #ifdef MMO_DBG gbfseek(fin, -2, SEEK_CUR); int ni, n; @@ -292,46 +292,46 @@ mmo_get_object(const gbuint16 objid) return data; } -static waypoint * -mmo_get_waypt(mmo_data_t *data) +static waypoint* +mmo_get_waypt(mmo_data_t* data) { data->refct++; if (data->refct == 1) { - return (waypoint *)data->data; + return (waypoint*)data->data; } else { - return waypt_dupe((waypoint *)data->data); + return waypt_dupe((waypoint*)data->data); } } static void -mmo_release_avltree(avltree_t *tree, const int is_object) +mmo_release_avltree(avltree_t* tree, const int is_object) { - const char *key; - char *name; + const char* key; + char* name; - if ((key = avltree_first(tree, (void *)&name))) { + if ((key = avltree_first(tree, (const void**)&name))) { do { if (name == NULL) { continue; } if (is_object) { - mmo_data_t *data = (mmo_data_t *)name; + mmo_data_t* data = (mmo_data_t*)name; if (data->name) { xfree(data->name); } if ((data->type == wptdata) && (data->refct == 0)) { - waypt_free((waypoint *)data->data); + waypt_free((waypoint*)data->data); } } xfree(name); - } while ((key = avltree_next(tree, key, (void *)&name))); + } while ((key = avltree_next(tree, key, (const void**)&name))); } avltree_done(tree); } static void -mmo_register_icon(const int id, const char *name) +mmo_register_icon(const int id, const char* name) { char key[16]; @@ -340,16 +340,16 @@ mmo_register_icon(const int id, const char *name) } -static mmo_data_t *mmo_read_object(void); +static mmo_data_t* mmo_read_object(void); static void -mmo_end_of_route(mmo_data_t *data) +mmo_end_of_route(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjRoute"; + const char* sobj = "CObjRoute"; #endif - route_head *rte = data->data; + route_head* rte = (route_head*) data->data; char buf[7]; if (mmo_version >= 0x12) { @@ -372,12 +372,12 @@ mmo_end_of_route(mmo_data_t *data) static void -mmo_read_category(mmo_data_t *data) +mmo_read_category(mmo_data_t* data) { int marker = gbfgetuint16(fin); if (marker & 0x8000) { - mmo_data_t *tmp; + mmo_data_t* tmp; DBG(("mmo_read_category", "reading category object\n")); gbfseek(fin, -2, SEEK_CUR); @@ -390,10 +390,10 @@ mmo_read_category(mmo_data_t *data) static void -mmo_read_CObjIcons(mmo_data_t *data) +mmo_read_CObjIcons(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjIcons"; + const char* sobj = "CObjIcons"; #endif int icon_id; gbuint16 u16; @@ -420,7 +420,7 @@ mmo_read_CObjIcons(mmo_data_t *data) DBG((sobj, "unknown value = 0x%04X\n", u16)); while ((icon_id = gbfgetuint32(fin))) { - char *name; + char* name; (void) gbfgetuint32(fin); (void) gbfgetuint32(fin); name = mmo_readstr(); @@ -435,16 +435,16 @@ mmo_read_CObjIcons(mmo_data_t *data) static void -mmo_read_CObjWaypoint(mmo_data_t *data) +mmo_read_CObjWaypoint(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjWaypoint"; + const char* sobj = "CObjWaypoint"; #endif - waypoint *wpt; + waypoint* wpt; time_t time; int rtelinks; - mmo_data_t **rtelink = NULL; - char *str; + mmo_data_t** rtelink = NULL; + char* str; char buf[16]; int i, ux; @@ -483,11 +483,11 @@ mmo_read_CObjWaypoint(mmo_data_t *data) rtelinks = gbfgetuint16(fin); if (rtelinks > 0) { - rtelink = xcalloc(sizeof(*rtelink), rtelinks); + rtelink = (mmo_data_t**) xcalloc(sizeof(*rtelink), rtelinks); DBG((sobj, "rtelinks = %d\n", rtelinks)); for (i = 0; i < rtelinks; i++) { - mmo_data_t *tmp; + mmo_data_t* tmp; DBG((sobj, "read rtelink number %d\n", i + 1)); rtelink[i] = tmp = mmo_read_object(); @@ -497,7 +497,7 @@ mmo_read_CObjWaypoint(mmo_data_t *data) str = mmo_readstr(); /* descr + url */ if (strncmp(str, "_FILE_ ", 7) == 0) { - char *cx, *cend; + char* cx, *cend; cx = lrtrim(str + 7); cend = strchr(cx, '\n'); @@ -532,10 +532,10 @@ mmo_read_CObjWaypoint(mmo_data_t *data) i = le_read32(&buf[8]); /* icon */ if (i != -1) { char key[16]; - char *name; + char* name; snprintf(key, sizeof(key), "%d", i); - if (avltree_find(icons, key, (void *)&name)) { + if (avltree_find(icons, key, (const void**)&name)) { wpt->icon_descr = xstrdup(name); wpt->wpt_flags.icon_descr_is_dynamic = 1; DBG((sobj, "icon = \"%s\"\n", wpt->icon_descr)); @@ -576,13 +576,13 @@ mmo_read_CObjWaypoint(mmo_data_t *data) static void -mmo_read_CObjRoute(mmo_data_t *data) +mmo_read_CObjRoute(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjRoute"; + const char* sobj = "CObjRoute"; #endif int rtept; - route_head *rte; + route_head* rte; char buf[16]; int ux; @@ -623,12 +623,12 @@ mmo_read_CObjRoute(mmo_data_t *data) } while (data->left > 0) { - mmo_data_t *tmp; + mmo_data_t* tmp; DBG((sobj, "read next waypoint\n")); tmp = mmo_read_object(); if (tmp && tmp->data && (tmp->type = wptdata)) { - waypoint *wpt; + waypoint* wpt; /* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!! We need a final procedure to handle this !!! */ @@ -653,13 +653,13 @@ mmo_read_CObjRoute(mmo_data_t *data) static void -mmo_read_CObjTrack(mmo_data_t *data) +mmo_read_CObjTrack(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjTrack"; + const char* sobj = "CObjTrack"; #endif int tp, ctp; - route_head *trk; + route_head* trk; DBG((sobj, ":-----------------------------------------------------\n")); DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n", @@ -685,7 +685,7 @@ mmo_read_CObjTrack(mmo_data_t *data) DBG((sobj, "track has %d point(s)\n", tp)); for (ctp = 0; ctp < tp; ctp++) { - waypoint *wpt; + waypoint* wpt; char unk; wpt = waypt_new(); @@ -766,14 +766,14 @@ mmo_read_CObjTrack(mmo_data_t *data) static void -mmo_read_CObjText(mmo_data_t *data) +mmo_read_CObjText(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjText"; + const char* sobj = "CObjText"; #endif char buf[28]; double lat, lon; - char *text, *font; + char* text, *font; DBG((sobj, ":-----------------------------------------------------\n")); DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n", @@ -798,10 +798,10 @@ mmo_read_CObjText(mmo_data_t *data) static void -mmo_read_CObjCurrentPosition(mmo_data_t *data) +mmo_read_CObjCurrentPosition(mmo_data_t* data) { #ifdef MMO_DBG - const char *sobj = "CObjCurrentPosition"; + const char* sobj = "CObjCurrentPosition"; #endif char buf[24]; double lat, lon; @@ -817,7 +817,7 @@ mmo_read_CObjCurrentPosition(mmo_data_t *data) mmo_fillbuf(buf, 24, 1); if (mmo_version >= 0x14) { - char *name; + char* name; name = mmo_readstr(); DBG((sobj, "name = \"%s\"\n", name)); @@ -827,11 +827,11 @@ mmo_read_CObjCurrentPosition(mmo_data_t *data) } -static mmo_data_t * +static mmo_data_t* mmo_read_object(void) { int objid; - mmo_data_t *data = NULL; + mmo_data_t* data = NULL; // There are three cases: // a new object of a type that has not occurred previously in this file; @@ -841,7 +841,7 @@ mmo_read_object(void) objid = gbfgetuint16(fin); if (objid == 0xFFFF) { gbuint16 version; - char *sobj; + char* sobj; int len; DBG(("mmo_read_object", "Registering new object type\n")); @@ -852,7 +852,7 @@ mmo_read_object(void) len = gbfgetint16(fin); - sobj = xmalloc(len + 1); + sobj = (char*) xmalloc(len + 1); sobj[len] = '\0'; gbfread(sobj, len, 1, fin); DBG(("mmo_read_object", "%s\n", sobj)); @@ -880,7 +880,7 @@ mmo_read_object(void) DBG(("mmo_read_object", "objid = 0x%04X\n", objid)); if (objid & 0x8000) { - data = mmo_register_object(mmo_object_id++, NULL, 0); + data = mmo_register_object(mmo_object_id++, NULL, (gpsdata_type)0); data->name = mmo_readstr(); if (objid != cat_object_id) { @@ -947,16 +947,16 @@ mmo_read_object(void) } static void -mmo_finalize_rtept_cb(const waypoint *wptref) +mmo_finalize_rtept_cb(const waypoint* wptref) { - waypoint *wpt = (waypoint *)wptref; + waypoint* wpt = (waypoint*)wptref; if ((wpt->shortname[0] == 1) && (wpt->latitude == 0) && (wpt->longitude == 0)) { - mmo_data_t *data; - waypoint *wpt2; + mmo_data_t* data; + waypoint* wpt2; sscanf(wpt->shortname + 1, "%p", &data); - wpt2 = (waypoint *)data->data; + wpt2 = (waypoint*)data->data; wpt->latitude = wpt2->latitude; wpt->longitude = wpt2->longitude; @@ -989,7 +989,7 @@ mmo_finalize_rtept_cb(const waypoint *wptref) *******************************************************************************/ static void -mmo_rd_init(const char *fname) +mmo_rd_init(const char* fname) { int i; @@ -1028,9 +1028,9 @@ static void mmo_read(void) { #ifdef MMO_DBG - const char *sobj = "main"; + const char* sobj = "main"; #endif - gbfile *fx; + gbfile* fx; int i; /* copy file to memory stream (needed for seek-ops and piped commands) */ @@ -1075,7 +1075,7 @@ mmo_read(void) /**************************************************************************/ static void -mmo_register_category_names(const char *name) +mmo_register_category_names(const char* name) { char key[16]; @@ -1085,7 +1085,7 @@ mmo_register_category_names(const char *name) static void -mmo_writestr(const char *str) +mmo_writestr(const char* str) { int len = strlen(str); @@ -1103,14 +1103,14 @@ mmo_writestr(const char *str) static void -mmo_enum_waypt_cb(const waypoint *wpt) +mmo_enum_waypt_cb(const waypoint* wpt) { mmo_obj_ct++; } static void -mmo_enum_route_cb(const route_head *rte) +mmo_enum_route_cb(const route_head* rte) { if (rte->rte_waypt_ct > 0) { mmo_obj_ct++; @@ -1119,14 +1119,14 @@ mmo_enum_route_cb(const route_head *rte) static int -mmo_write_obj_mark(const char *sobj, const char *name) +mmo_write_obj_mark(const char* sobj, const char* name) { - char *key; + char* key; gbuint16 nr; char buf[16]; int res; - if (avltree_find(mmobjects, sobj, (void *)&key)) { + if (avltree_find(mmobjects, sobj, (const void**)&key)) { nr = (unsigned)atoi(key); gbfputuint16(nr, fout); } else { @@ -1152,12 +1152,12 @@ mmo_write_obj_mark(const char *sobj, const char *name) static void -mmo_write_category(const char *sobj, const char *name) +mmo_write_category(const char* sobj, const char* name) { - char *key; + char* key; gbuint16 nr; - if (avltree_find(category_names, name, (void *)&key)) { + if (avltree_find(category_names, name, (const void**)&key)) { nr = (unsigned)atoi(key); gbfputuint16(nr & 0x7FFF, fout); } else { @@ -1168,7 +1168,7 @@ mmo_write_category(const char *sobj, const char *name) static int -mmo_write_obj_head(const char *sobj, const char *name, const time_t ctime, +mmo_write_obj_head(const char* sobj, const char* name, const time_t ctime, const gbuint32 obj_type) { int res; @@ -1188,13 +1188,13 @@ mmo_write_obj_head(const char *sobj, const char *name, const time_t ctime, static void -mmo_write_wpt_cb(const waypoint *wpt) +mmo_write_wpt_cb(const waypoint* wpt) { - char *str, *cx; + char* str, *cx; int objid; time_t time; int icon = 0; - mmo_data_t *data; + mmo_data_t* data; time = wpt->creation_time; if (time < 0) { @@ -1247,7 +1247,7 @@ mmo_write_wpt_cb(const waypoint *wpt) cx = wpt->description; } if (cx != NULL) { - char *kml = NULL; + char* kml = NULL; if (strcmp(wpt->session->name, "kml") == 0) { utf_string tmp; @@ -1290,20 +1290,20 @@ mmo_write_wpt_cb(const waypoint *wpt) static void -mmo_write_rte_head_cb(const route_head *rte) +mmo_write_rte_head_cb(const route_head* rte) { int objid; - queue *elem, *tmp; + queue* elem, *tmp; time_t time = 0x7FFFFFFF; if (rte->rte_waypt_ct <= 0) { return; } - mmo_rte = (route_head *)rte; + mmo_rte = (route_head*)rte; QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; if ((wpt->creation_time > 0) && (wpt->creation_time < time)) { time = wpt->creation_time; @@ -1323,9 +1323,9 @@ mmo_write_rte_head_cb(const route_head *rte) static void -mmo_write_rte_tail_cb(const route_head *rte) +mmo_write_rte_tail_cb(const route_head* rte) { - queue *elem, *tmp; + queue* elem, *tmp; if (rte->rte_waypt_ct <= 0) { return; @@ -1348,7 +1348,7 @@ mmo_write_rte_tail_cb(const route_head *rte) } QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; int objid = mmo_get_objid(wpt); gbfputuint16(objid & 0x7FFF, fout); } @@ -1356,7 +1356,7 @@ mmo_write_rte_tail_cb(const route_head *rte) static void -mmo_write_trk_head_cb(const route_head *trk) +mmo_write_trk_head_cb(const route_head* trk) { int objid; @@ -1374,7 +1374,7 @@ mmo_write_trk_head_cb(const route_head *trk) static void -mmo_write_trk_tail_cb(const route_head *trk) +mmo_write_trk_tail_cb(const route_head* trk) { if (trk->rte_waypt_ct <= 0) { return; @@ -1408,7 +1408,7 @@ mmo_write_trk_tail_cb(const route_head *trk) /**************************************************************************/ static void -mmo_wr_init(const char *fname) +mmo_wr_init(const char* fname) { fout = gbfopen_le(fname, "wb", MYNAME); diff --git a/gpsbabel/msroute.c b/gpsbabel/msroute.c index da44eb51c..6c5cbd590 100644 --- a/gpsbabel/msroute.c +++ b/gpsbabel/msroute.c @@ -28,7 +28,7 @@ #undef OLE_DEBUG -static gbfile *fin; +static gbfile* fin; static arglist_t msroute_args[] = { ARG_TERMINATOR @@ -137,23 +137,23 @@ static int sector_sz = 512; #define max(a,b) ((a) > (b)) ? (a) : (b) #endif -static gbint32 *ole_fat1 = NULL; -static gbint32 *ole_fat2 = NULL; +static gbint32* ole_fat1 = NULL; +static gbint32* ole_fat2 = NULL; static int ole_fat1_ct; static int ole_fat2_ct; static int ole_size1; static int ole_size2; static int ole_size1_min = 4096; -static ole_prop_t *ole_dir = NULL; +static ole_prop_t* ole_dir = NULL; static int ole_dir_ct; -static ole_prop_t *ole_root = NULL; -static char **ole_root_sec = NULL; +static ole_prop_t* ole_root = NULL; +static char** ole_root_sec = NULL; static int ole_root_sec_ct; /* local helpers */ static void -le_read32_buff(int *buff, const int count) +le_read32_buff(int* buff, const int count) { int i; for (i = 0; i < count; i++) { @@ -164,7 +164,7 @@ le_read32_buff(int *buff, const int count) /* simple OLE file reader */ static void -ole_read_sector(const int sector, void *target, const char full) +ole_read_sector(const int sector, void* target, const char full) { int res; @@ -176,15 +176,15 @@ ole_read_sector(const int sector, void *target, const char full) MYNAME ": Read error (%d, sector %d) on file \"%s\"!", res, sector, fin->name); } -static ole_prop_t * -ole_find_property(const char *property) +static ole_prop_t* +ole_find_property(const char* property) { int i; for (i = 0; i < ole_dir_ct; i++) { int len, test; - char *str; - ole_prop_t *item; + char* str; + ole_prop_t* item; item = &ole_dir[i]; if ((item->ole_typ != 1) && (item->ole_typ != 2) && (item->ole_typ != 5)) { @@ -195,7 +195,7 @@ ole_find_property(const char *property) } len = min(OLE_MAX_NAME_LENGTH, item->name_sz / 2); - str = cet_str_uni_to_utf8((short *)&item->name, len); + str = cet_str_uni_to_utf8((short*)&item->name, len); test = case_ignore_strcmp(str, property); xfree(str); @@ -207,14 +207,14 @@ ole_find_property(const char *property) return 0; } -static char * -ole_read_stream(const ole_prop_t *property) +static char* +ole_read_stream(const ole_prop_t* property) { - const char *action = "ole_read_stream"; + const char* action = "ole_read_stream"; int len, sector, big, blocksize, offs, left; int i; - int *fat; - char *buff; + int* fat; + char* buff; len = property->data_sz; @@ -233,7 +233,7 @@ ole_read_stream(const ole_prop_t *property) sector = property->first_sector; i = ((len + blocksize - 1) / blocksize) * blocksize; - buff = xmalloc(i); /* blocksize aligned */ + buff = (char*) xmalloc(i); /* blocksize aligned */ if (big != 0) { while (left > 0) { @@ -254,7 +254,7 @@ ole_read_stream(const ole_prop_t *property) offs = 0; while (blocks-- > 0) { - char *temp; + char* temp; int block_offs; is_fatal((chain < 0), MYNAME ": Broken stream (%s)!", action); @@ -277,11 +277,11 @@ ole_read_stream(const ole_prop_t *property) } -static char * -ole_read_property_stream(const char *property_name, int *data_sz) +static char* +ole_read_property_stream(const char* property_name, int* data_sz) { - ole_prop_t *property; - char *result; + ole_prop_t* property; + char* result; if ((property = ole_find_property(property_name)) == NULL) { return NULL; @@ -303,9 +303,9 @@ ole_test_properties() int i; for (i = 0; i < ole_dir_ct; i++) { - char *temp; + char* temp; char name[OLE_MAX_NAME_LENGTH + 1]; - ole_prop_t *p = &ole_dir[i]; + ole_prop_t* p = &ole_dir[i]; if ((p->ole_typ != 1) && (p->ole_typ != 2) && (p->ole_typ != 5)) { continue; @@ -371,7 +371,7 @@ ole_init(void) memset(&head, 0, sizeof(head)); gbfread(&head, sizeof(head), 1, fin); - is_fatal((strncmp(head.magic, (char *) ole_magic, sizeof(ole_magic)) != 0), MYNAME ": No MS document."); + is_fatal((strncmp(head.magic, (char*) ole_magic, sizeof(ole_magic)) != 0), MYNAME ": No MS document."); head.rev = le_read16(&head.rev); head.ver = le_read16(&head.ver); @@ -413,7 +413,7 @@ ole_init(void) #else is_fatal((ole_size1 != 512), MYNAME ": Unsupported sector size %d", ole_size1); #endif - ole_fat1 = xmalloc(head.fat1_blocks * sector_sz); + ole_fat1 = (gbint32*) xmalloc(head.fat1_blocks * sector_sz); ole_fat1_ct = (head.fat1_blocks * sector_sz) / sizeof(gbint32); #ifdef OLE_DEBUG @@ -464,12 +464,12 @@ ole_init(void) count = 0; do { if (ole_fat2 == NULL) { - ole_fat2 = (int *)xmalloc((count + 1) * sector_sz); + ole_fat2 = (int*)xmalloc((count + 1) * sector_sz); } else { - ole_fat2 = (int *)xrealloc(ole_fat2, (count + 1) * sector_sz); + ole_fat2 = (int*)xrealloc(ole_fat2, (count + 1) * sector_sz); } - ole_read_sector(sector, (char *)ole_fat2 + (count * sector_sz), 1); + ole_read_sector(sector, (char*)ole_fat2 + (count * sector_sz), 1); sector = ole_fat1[sector]; count++; @@ -489,12 +489,12 @@ ole_init(void) count = 0; while (sector >= 0) { if (ole_dir == NULL) { - ole_dir = (void *)xmalloc((count + 1) * sector_sz); + ole_dir = (ole_prop_t*)xmalloc((count + 1) * sector_sz); } else { - ole_dir = (void *)xrealloc(ole_dir, (count + 1) * sector_sz); + ole_dir = (ole_prop_t*)xrealloc(ole_dir, (count + 1) * sector_sz); } - ole_read_sector(sector, (char *)ole_dir + (count * sector_sz), 1); + ole_read_sector(sector, (char*)ole_dir + (count * sector_sz), 1); sector = ole_fat1[sector]; count++; @@ -504,7 +504,7 @@ ole_init(void) /* fix endianess of property catalog */ for (i = 0; i < ole_dir_ct; i++) { - ole_prop_t *item = &ole_dir[i]; + ole_prop_t* item = &ole_dir[i]; item->first_sector = le_read32(&item->first_sector); item->data_sz = le_read32(&item->data_sz); @@ -515,14 +515,14 @@ ole_init(void) /* read fat2 data sectors given by "Root Entry" */ ole_root_sec_ct = (ole_root->data_sz + (sector_sz - 1)) / sector_sz; - ole_root_sec = xcalloc(ole_root_sec_ct + 1, sizeof(char *)); + ole_root_sec = (char**) xcalloc(ole_root_sec_ct + 1, sizeof(char*)); i = 0; sector = ole_root->first_sector; while (sector >= 0) { - char *temp; + char* temp; - temp = ole_root_sec[i++] = xmalloc(sector_sz); + temp = ole_root_sec[i++] = (char*) xmalloc(sector_sz); ole_read_sector(sector, temp, 1); sector = ole_fat1[sector]; @@ -538,7 +538,7 @@ ole_deinit(void) if (ole_root_sec != NULL) { int i; for (i = 0; i < ole_root_sec_ct; i++) { - char *c; + char* c; if ((c = ole_root_sec[i])) { xfree(c); } @@ -562,16 +562,16 @@ static void msroute_read_journey(void) { int bufsz = 0; - char *buff; + char* buff; buff = ole_read_property_stream(MSROUTE_OBJ_NAME, &bufsz); if ((buff != NULL) && (bufsz > 0)) { - msroute_head_t *head = (msroute_head_t *)buff; - unsigned char *cin, *cend; + msroute_head_t* head = (msroute_head_t*)buff; + unsigned char* cin, *cend; int count = 0; - route_head *route; - waypoint *wpt; + route_head* route; + waypoint* wpt; char version; is_fatal((strncmp(head->masm, "MASM", 4) != 0), MYNAME ": Invalid or unknown data!"); @@ -579,8 +579,8 @@ msroute_read_journey(void) version = buff[0x14]; is_fatal((version < 1) || (version > 7), MYNAME ": Unsupported version %d!", version); - cin = (unsigned char *)buff + 71; // (at least?) sizeof(msroute_head_t); - cend = (unsigned char *)buff + bufsz; + cin = (unsigned char*)buff + 71; // (at least?) sizeof(msroute_head_t); + cend = (unsigned char*)buff + bufsz; route = route_head_alloc(); route_add_head(route); @@ -618,7 +618,7 @@ msroute_read_journey(void) cin += 3; /* 0xfffeff */ len = *cin++; - wpt->shortname = cet_str_uni_to_utf8((const short *)cin, len); + wpt->shortname = cet_str_uni_to_utf8((const short*)cin, len); cin += (len * 2); /* seek over wide string */ cin += (5 * sizeof(gbint32)); /* five unknown DWORDs */ @@ -645,7 +645,7 @@ msroute_read_journey(void) /* registered callbacks */ -static void msroute_rd_init(const char *fname) +static void msroute_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); diff --git a/gpsbabel/mtk_logger.c b/gpsbabel/mtk_logger.c index 6d3a9ceba..b59db9574 100644 --- a/gpsbabel/mtk_logger.c +++ b/gpsbabel/mtk_logger.c @@ -105,7 +105,7 @@ static const unsigned char LOG_RST[16] = { 0xbb, 0xbb, 0xbb, 0xbb }; /* end marker */ -static const char *MTK_ACK[] = { /* Flags returned from PMTK001 ack packet */ +static const char* MTK_ACK[] = { /* Flags returned from PMTK001 ack packet */ "Invalid packet", "Unsupported packet type", "Valid packet but action failed", "Valid packet, action success" }; @@ -146,7 +146,7 @@ enum { struct log_type { int id; int size; - const char *name; + const char* name; } log_type[32] = { { 0, 4, "UTC" }, { 1, 2, "VALID" }, @@ -216,13 +216,13 @@ enum MTK_DEVICE_TYPE { #define HOLUX245_MASK (1 << 27) -static void *fd; /* serial fd */ -static FILE *fl; /* bin.file fd */ -static char *port; /* serial port name */ -static char *OPT_erase; /* erase ? command option */ -static char *OPT_erase_only; /* erase_only ? command option */ -static char *OPT_log_enable; /* enable ? command option */ -static char *csv_file; /* csv ? command option */ +static void* fd; /* serial fd */ +static FILE* fl; /* bin.file fd */ +static char* port; /* serial port name */ +static char* OPT_erase; /* erase ? command option */ +static char* OPT_erase_only; /* erase_only ? command option */ +static char* OPT_log_enable; /* enable ? command option */ +static char* csv_file; /* csv ? command option */ static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER; struct mtk_loginfo mtk_info; @@ -239,12 +239,12 @@ const char CMD_LOG_ERASE[] = "$PMTK182,6,1*3E\r\n"; const char CMD_LOG_STATUS[] = "$PMTK182,2,7*3C\r\n"; static int mtk_log_len(unsigned int bitmask); -static void mtk_rd_init(const char *fname); -static void file_init(const char *fname); +static void mtk_rd_init(const char* fname); +static void file_init(const char* fname); static void file_deinit(void) ; static void holux245_init(void); static void file_read(void); -static int mtk_parse_info(const unsigned char *data, int dataLen); +static int mtk_parse_info(const unsigned char* data, int dataLen); // Arguments for log fetch 'mtk' command.. @@ -269,7 +269,7 @@ static arglist_t mtk_sargs[] = { ARG_TERMINATOR }; -static void dbg(int l, const char *msg, ...) +static void dbg(int l, const char* msg, ...) { va_list ap; va_start(ap, msg); @@ -279,7 +279,7 @@ static void dbg(int l, const char *msg, ...) } va_end(ap); } -static int do_send_cmd(const char *cmd, int cmdLen) +static int do_send_cmd(const char* cmd, int cmdLen) { int rc; @@ -293,7 +293,7 @@ static int do_send_cmd(const char *cmd, int cmdLen) } -static int do_cmd(const char *cmd, const char *expect, char **rslt, time_t timeout_sec) +static int do_cmd(const char* cmd, const char* expect, char** rslt, time_t timeout_sec) { char line[256]; int len, done, loops, cmd_erase; @@ -359,7 +359,7 @@ static int do_cmd(const char *cmd, const char *expect, char **rslt, time_t timeo } // printf("Data segment: #%s#\n", &line[expect_len+1]); if (rslt) { - *rslt = xmalloc(len-3-expect_len+1); + *rslt = (char*) xmalloc(len-3-expect_len+1); strcpy(*rslt, &line[expect_len+1]); } } @@ -367,7 +367,7 @@ static int do_cmd(const char *cmd, const char *expect, char **rslt, time_t timeo } else if (strncmp(line, "$PMTK", 5) == 0) { /* A quick parser for ACK packets */ if (!cmd_erase && strncmp(line, "$PMTK001,", 9) == 0 && line[9] != '\0') { - char *pType, *pRslt; + char* pType, *pRslt; int pAck; pType = &line[9]; pRslt = strchr(&line[9], ',') + 1; @@ -395,16 +395,16 @@ static int do_cmd(const char *cmd, const char *expect, char **rslt, time_t timeo /******************************************************************************* * %%% global callbacks called by gpsbabel main process %%% * *******************************************************************************/ -static void mtk_rd_init_m241(const char *fname) +static void mtk_rd_init_m241(const char* fname) { mtk_device = HOLUX_M241; mtk_rd_init(fname); } -static void mtk_rd_init(const char *fname) +static void mtk_rd_init(const char* fname) { int rc; - char *model; + char* model; port = xstrdup(fname); @@ -469,7 +469,7 @@ static void mtk_rd_deinit(void) static int mtk_erase(void) { int log_status, log_mask, err; - char *lstatus = NULL; + char* lstatus = NULL; log_status = 0; // check log status - is logging disabled ? @@ -507,13 +507,13 @@ static int mtk_erase(void) static void mtk_read(void) { char cmd[256]; - char *line = NULL; + char* line = NULL; unsigned char crc, *data = NULL; int cmdLen, j, bsize, i, len, ff_len, null_len, rc, init_scan, retry_cnt, log_enabled; unsigned int line_size, data_size, data_addr, addr, addr_max; unsigned long dsize, dpos = 0; - FILE *dout; - char *fusage = NULL; + FILE* dout; + char* fusage = NULL; if (*OPT_erase_only != '0') { @@ -591,10 +591,10 @@ static void mtk_read(void) line_size = 2*bsize + 32; // logdata as nmea/hex. data_size = bsize + 32; - if ((line = xmalloc(line_size)) == NULL) { + if ((line = (char*) xmalloc(line_size)) == NULL) { fatal(MYNAME ": Can't allocate %u bytes for NMEA buffer\n", line_size); } - if ((data = xmalloc(data_size)) == NULL) { + if ((data = (unsigned char*) xmalloc(data_size)) == NULL) { fatal(MYNAME ": Can't allocate %u bytes for data buffer\n", data_size); } memset(line, '\0', line_size); @@ -742,13 +742,13 @@ mtk_retry: } -static route_head *trk_head = NULL; -static int add_trackpoint(int idx, unsigned long bmask, struct data_item *itm) +static route_head* trk_head = NULL; +static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) { char wp_name[20]; - waypoint *trk = waypt_new(); + waypoint* trk = waypt_new(); - if (global_opts.masked_objective & TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) { + if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) { char spds[50]; trk_head = route_head_alloc(); xasprintf(&trk_head->rte_name, "track-%d", 1+track_count()); @@ -841,7 +841,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item *itm) ) ) { /* Button press -- create waypoint, start count at 1 */ - waypoint *w = waypt_dupe(trk); + waypoint* w = waypt_dupe(trk); sprintf(wp_name, "WP%06d", waypt_count()+1); w->shortname = xstrdup(wp_name); @@ -863,11 +863,11 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item *itm) /********************** MTK Logger -- CSV output *************************/ -static gbfile *cd; -static void mtk_csv_init(char *csv_fname, unsigned long bitmask) +static gbfile* cd; +static void mtk_csv_init(char* csv_fname, unsigned long bitmask) { int i; - FILE *cf; + FILE* cf; dbg(1, "Opening csv output file %s...\n", csv_fname); @@ -925,11 +925,11 @@ static void mtk_csv_deinit(void) } /* Output a single data line in MTK application compatible format - i.e ignore any locale settings... */ -static int csv_line(gbfile *csvFile, int idx, unsigned long bmask, struct data_item *itm) +static int csv_line(gbfile* csvFile, int idx, unsigned long bmask, struct data_item* itm) { - struct tm *ts_tm; + struct tm* ts_tm; char ts_str[30]; - const char *fix_str = ""; + const char* fix_str = ""; ts_tm = gmtime(&(itm->timestamp)); strftime(ts_str, sizeof(ts_str)-1, "%Y/%m/%d,%H:%M:%S", ts_tm); @@ -1054,7 +1054,7 @@ static int csv_line(gbfile *csvFile, int idx, unsigned long bmask, struct data_i /********************* MTK Logger -- Parse functions *********************/ -int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask) +int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask) { static int count = 0; int i, k, sat_id, hspd; @@ -1269,7 +1269,7 @@ int mtk_parse(unsigned char *data, int dataLen, unsigned int bmask) Description: Parse an info block Globals: mtk_info - bitmask/period/speed/... may be affected if updated. */ -static int mtk_parse_info(const unsigned char *data, int dataLen) +static int mtk_parse_info(const unsigned char* data, int dataLen) { unsigned short cmd; unsigned int bm; @@ -1379,13 +1379,13 @@ static int mtk_log_len(unsigned int bitmask) /********************** File-in interface ********************************/ -static void file_init_m241(const char *fname) +static void file_init_m241(const char* fname) { mtk_device = HOLUX_M241; file_init(fname); } -static void file_init(const char *fname) +static void file_init(const char* fname) { dbg(4, "Opening file %s...\n", fname); if (fl = fopen(fname, "rb"), NULL == fl) { @@ -1420,7 +1420,7 @@ static void holux245_init(void) log_type[SPEED].size = 3; // height size.. } -static int is_holux_string(const unsigned char *data, int dataLen) +static int is_holux_string(const unsigned char* data, int dataLen) { if (mtk_device != MTK_LOGGER && dataLen >= 5 && diff --git a/gpsbabel/navicache.c b/gpsbabel/navicache.c index 5f398a018..2082745f7 100644 --- a/gpsbabel/navicache.c +++ b/gpsbabel/navicache.c @@ -23,11 +23,11 @@ static XML_Parser psr; #endif -static waypoint *wpt_tmp; +static waypoint* wpt_tmp; -static gbfile *fin, *fout; +static gbfile* fin, *fout; -static char *noretired = NULL; +static char* noretired = NULL; static arglist_t nav_args[] = { @@ -44,7 +44,7 @@ arglist_t nav_args[] = { #if ! HAVE_LIBEXPAT static void -nav_rd_init(const char *fname) +nav_rd_init(const char* fname) { fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n"); } @@ -58,7 +58,7 @@ nav_read(void) static struct nc_type_mapping { geocache_type type; - const char *name; + const char* name; } nc_type_map[] = { { gt_unknown, "unknown" }, { gt_traditional, "normal" }, @@ -70,7 +70,7 @@ static struct static struct nc_container_mapping { geocache_container type; - const char *name; + const char* name; } nc_container_map[] = { { gc_other, "Unknown" }, { gc_micro, "Micro" }, @@ -81,7 +81,7 @@ static struct static geocache_type -nc_mktype(const char *t) +nc_mktype(const char* t) { int i; int sz = sizeof(nc_type_map) / sizeof(nc_type_map[0]); @@ -96,7 +96,7 @@ nc_mktype(const char *t) static geocache_container -nc_mkcont(const char *t) +nc_mkcont(const char* t) { int i; int sz = sizeof(nc_container_map) / sizeof(nc_container_map[0]); @@ -110,16 +110,16 @@ nc_mkcont(const char *t) } static void -nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) +nav_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) { - const char *el; - const char **attr; + const char* el; + const char** attr; el = xml_convert_to_char_string(xml_el); attr = xml_convert_attrs_to_char_string(xml_attr); if (0 == strcmp(el, "CacheDetails")) { - const char **ap; - geocache_data *gc_data; + const char** ap; + geocache_data* gc_data; wpt_tmp = waypt_new(); gc_data = waypt_alloc_gc_data(wpt_tmp); @@ -200,12 +200,12 @@ nav_start(void *data, const XML_Char *xml_el, const XML_Char **xml_attr) } static void -nav_end(void *data, const XML_Char *el) +nav_end(void* data, const XML_Char* el) { } static void -nav_rd_init(const char *fname) +nav_rd_init(const char* fname) { fin = gbfopen(fname, "r", MYNAME); @@ -244,7 +244,7 @@ nav_rd_deinit(void) } static void -nav_wr_init(const char *fname) +nav_wr_init(const char* fname) { fatal(MYNAME ": Does not support writing Navicache files.\n"); fout = gbfopen(fname, "w", MYNAME); diff --git a/gpsbabel/naviguide.c b/gpsbabel/naviguide.c index 840a8ae02..80be9bdb3 100755 --- a/gpsbabel/naviguide.c +++ b/gpsbabel/naviguide.c @@ -69,9 +69,9 @@ typedef struct { /* Global variables */ -static gbfile *file_in, *file_out; +static gbfile* file_in, *file_out; static gbuint16 nof_wp; -static route_head *rte_head; +static route_head* rte_head; static ng_file_header_t ng_file_header; static ng_wp_no_comment_t WPNC; static ng_next_wp_t ng_next_wp; @@ -81,8 +81,8 @@ static char strComment[101]; /* wp - process only waypoints */ /* rte - process as route */ /* wprte - Process waypoints and route */ -static char *process = NULL; -static char *reorder = NULL; +static char* process = NULL; +static char* reorder = NULL; static int process_rte = 1; static int reorder_wp = 0; @@ -111,7 +111,7 @@ arglist_t ng_args[] = { /*===================Utilities ==========================================*/ static void -ng_convert_datum(waypoint *wpt) +ng_convert_datum(waypoint* wpt) { double lat, lon, east, north, alt; @@ -130,7 +130,7 @@ ng_convert_datum(waypoint *wpt) /*=================== File read/write utilities ==========================================*/ static void -ng_fwrite_wp_data(char *s, char *d, ng_wp_data_t *wp_data, gbfile *f) +ng_fwrite_wp_data(char* s, char* d, ng_wp_data_t* wp_data, gbfile* f) { int i; char z[50]; @@ -154,7 +154,7 @@ ng_fwrite_wp_data(char *s, char *d, ng_wp_data_t *wp_data, gbfile *f) } static void -ng_fwrite_next_wp(ng_next_wp_t *nwp, gbfile *f) +ng_fwrite_next_wp(ng_next_wp_t* nwp, gbfile* f) { gbfwrite(nwp->pad1, 2, 1, f); gbfputint16(nwp->next_wp, f); @@ -162,7 +162,7 @@ ng_fwrite_next_wp(ng_next_wp_t *nwp, gbfile *f) } static void -ng_fread_wp_data(char *d, ng_wp_no_comment_t *wpnc, gbfile *f) +ng_fread_wp_data(char* d, ng_wp_no_comment_t* wpnc, gbfile* f) { int i; @@ -187,7 +187,7 @@ ng_fread_wp_data(char *d, ng_wp_no_comment_t *wpnc, gbfile *f) } static void -ng_fread_next_wp(ng_next_wp_t *nwp, gbfile *f) +ng_fread_next_wp(ng_next_wp_t* nwp, gbfile* f) { gbfread(&nwp->pad1, 2, 1, f); nwp->next_wp = gbfgetint16(f); @@ -236,9 +236,9 @@ ng_fill_waypoint_default(void) static void -ng_waypt_rd(const waypoint * wpt) +ng_waypt_rd(const waypoint* wpt) { - char * s = NULL; + char* s = NULL; char z[50]; double lat, lon; @@ -305,7 +305,7 @@ data_write(void) static void -wr_init(const char *fname) +wr_init(const char* fname) { file_out = gbfopen_le(fname, "wb", MYNAME); ng_fill_header_default(); @@ -325,7 +325,7 @@ wr_deinit(void) /*=========================== Read data functions ==================================*/ static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen_le(fname, "rb", MYNAME); @@ -373,7 +373,7 @@ data_read(void) { int n; unsigned i; - waypoint *wpt_tmp; + waypoint* wpt_tmp; if (process_rte) { rte_head = route_head_alloc(); diff --git a/gpsbabel/navilink.c b/gpsbabel/navilink.c index 42ddab0ef..7c5b987d2 100644 --- a/gpsbabel/navilink.c +++ b/gpsbabel/navilink.c @@ -29,22 +29,22 @@ #define MYNAME "NAVILINK" -static char *nuketrk = NULL; -static char *nukerte = NULL; -static char *nukewpt = NULL; -static char *nukedlg = NULL; -static char *poweroff = NULL; -static char *datalog = NULL; - -static void *serial_handle = NULL; -static gbfile *file_handle = NULL; - -static unsigned char *track_data; -static unsigned char *track_data_ptr; -static unsigned char *track_data_end; +static char* nuketrk = NULL; +static char* nukerte = NULL; +static char* nukewpt = NULL; +static char* nukedlg = NULL; +static char* poweroff = NULL; +static char* datalog = NULL; + +static void* serial_handle = NULL; +static gbfile* file_handle = NULL; + +static unsigned char* track_data; +static unsigned char* track_data_ptr; +static unsigned char* track_data_end; static unsigned track_serial; -static waypoint **route_waypts; -static unsigned *route_ids; +static waypoint** route_waypts; +static unsigned* route_ids; static unsigned route_id_ptr; static enum { @@ -88,7 +88,7 @@ static enum { #define PID_CLEAR_DATALOG 0x1b static -const char *const icon_table[] = { +const char* const icon_table[] = { "Star", "Flag", "House", @@ -165,20 +165,20 @@ arglist_t navilink_args[] = { ARG_TERMINATOR }; -static void (*write_waypoint)(const waypoint *) = NULL; -static void (*write_track_start)(const route_head *track) = NULL; -static void (*write_track_point)(const waypoint *waypt) = NULL; -static void (*write_track_end)(const route_head *track) = NULL; -static void (*write_route_start)(const route_head *track) = NULL; -static void (*write_route_point)(const waypoint *waypt) = NULL; -static void (*write_route_end)(const route_head *track) = NULL; +static void (*write_waypoint)(const waypoint*) = NULL; +static void (*write_track_start)(const route_head* track) = NULL; +static void (*write_track_point)(const waypoint* waypt) = NULL; +static void (*write_track_end)(const route_head* track) = NULL; +static void (*write_route_start)(const route_head* track) = NULL; +static void (*write_route_point)(const waypoint* waypt) = NULL; +static void (*write_route_end)(const route_head* track) = NULL; static int -find_icon_from_descr(const char *descr) +find_icon_from_descr(const char* descr) { int i; - for (i = 0; descr && i < sizeof(icon_table) / sizeof(const char *); i++) { + for (i = 0; descr && i < sizeof(icon_table) / sizeof(const char*); i++) { if (strcmp(descr, icon_table[i]) == 0) { return i; } @@ -188,9 +188,9 @@ find_icon_from_descr(const char *descr) } static void -free_waypoints(waypoint **waypts) +free_waypoints(waypoint** waypts) { - waypoint **wayptp; + waypoint** wayptp; for (wayptp = waypts; wayptp < waypts + MAX_WAYPOINTS; wayptp++) { if (*wayptp) { @@ -202,7 +202,7 @@ free_waypoints(waypoint **waypts) } static unsigned -compare_waypoints(const waypoint *waypt1, const waypoint *waypt2) +compare_waypoints(const waypoint* waypt1, const waypoint* waypt2) { return waypt1->latitude == waypt2->latitude && waypt1->longitude == waypt2->longitude && @@ -211,7 +211,7 @@ compare_waypoints(const waypoint *waypt1, const waypoint *waypt2) } unsigned -navilink_checksum_packet(const unsigned char *packet, unsigned length) +navilink_checksum_packet(const unsigned char* packet, unsigned length) { unsigned checksum = 0; @@ -225,7 +225,7 @@ navilink_checksum_packet(const unsigned char *packet, unsigned length) #ifdef NAVILINK_DEBUG static void -dump_packet(char *prefix, unsigned char *packet, unsigned length) +dump_packet(char* prefix, unsigned char* packet, unsigned length) { unsigned i; @@ -245,9 +245,9 @@ dump_packet(char *prefix, unsigned char *packet, unsigned length) #endif static void -write_packet(unsigned type, const void *payload, unsigned length) +write_packet(unsigned type, const void* payload, unsigned length) { - unsigned char *packet = xmalloc(length + 9); + unsigned char* packet = (unsigned char*) xmalloc(length + 9); packet[0] = 0xa0; packet[1] = 0xa2; @@ -292,12 +292,12 @@ read_word(void) * Returns TRUE if the packet was successfully read into payload. */ static int -read_packet(unsigned type, void *payload, +read_packet(unsigned type, void* payload, unsigned minlength, unsigned maxlength, int handle_nak) { unsigned size; - unsigned char *data; + unsigned char* data; unsigned checksum; if (read_word() != 0xa2a0) { @@ -309,7 +309,7 @@ read_packet(unsigned type, void *payload, fatal(MYNAME ": Protocol error: Packet too short\n"); } - data = xmalloc(size); + data = (unsigned char*) xmalloc(size); if (gbser_read_wait(serial_handle, data, size, SERIAL_TIMEOUT) != size) { fatal(MYNAME ": Read error reading %d byte payload\n", size); @@ -348,7 +348,7 @@ read_packet(unsigned type, void *payload, } static time_t -decode_datetime(const unsigned char *buffer) +decode_datetime(const unsigned char* buffer) { struct tm tm; @@ -363,9 +363,9 @@ decode_datetime(const unsigned char *buffer) } static void -encode_datetime(time_t datetime, unsigned char *buffer) +encode_datetime(time_t datetime, unsigned char* buffer) { - struct tm *tm; + struct tm* tm; if ((tm = gmtime(&datetime)) != NULL) { buffer[0] = tm->tm_year - 100; @@ -380,7 +380,7 @@ encode_datetime(time_t datetime, unsigned char *buffer) } static void -decode_position(const unsigned char *buffer, waypoint *waypt) +decode_position(const unsigned char* buffer, waypoint* waypt) { waypt->latitude = le_read32(buffer + 0) / 10000000.0; waypt->longitude = le_read32(buffer + 4) / 10000000.0; @@ -388,7 +388,7 @@ decode_position(const unsigned char *buffer, waypoint *waypt) } static void -encode_position(const waypoint *waypt, unsigned char *buffer) +encode_position(const waypoint* waypt, unsigned char* buffer) { le_write32(buffer + 0, (int)(waypt->latitude * 10000000)); le_write32(buffer + 4, (int)(waypt->longitude * 10000000)); @@ -396,7 +396,7 @@ encode_position(const waypoint *waypt, unsigned char *buffer) } static unsigned -decode_waypoint_id(const unsigned char *buffer) +decode_waypoint_id(const unsigned char* buffer) { unsigned id = le_read16(buffer + 2); @@ -407,13 +407,13 @@ decode_waypoint_id(const unsigned char *buffer) return id; } -static waypoint * -decode_waypoint(const unsigned char *buffer) +static waypoint* +decode_waypoint(const unsigned char* buffer) { - waypoint *waypt = waypt_new(); + waypoint* waypt = waypt_new(); decode_position(buffer + 12, waypt); - waypt->shortname = xstrdup((char *)buffer + 4); + waypt->shortname = xstrdup((char*)buffer + 4); waypt->icon_descr = icon_table[buffer[28]]; waypt->creation_time = decode_datetime(buffer + 22); @@ -421,12 +421,12 @@ decode_waypoint(const unsigned char *buffer) } static void -encode_waypoint(const waypoint *waypt, unsigned char *buffer) +encode_waypoint(const waypoint* waypt, unsigned char* buffer) { buffer[0] = 0x00; buffer[1] = 0x40; le_write16(buffer + 2, 0); - strncpy((char *)buffer + 4, waypt->shortname, 6); + strncpy((char*)buffer + 4, waypt->shortname, 6); buffer[10] = 0; buffer[11] = 0; encode_position(waypt, buffer + 12); @@ -437,10 +437,10 @@ encode_waypoint(const waypoint *waypt, unsigned char *buffer) buffer[31] = 0x7e; } -static waypoint * -decode_trackpoint(const unsigned char *buffer) +static waypoint* +decode_trackpoint(const unsigned char* buffer) { - waypoint *waypt = waypt_new(); + waypoint* waypt = waypt_new(); decode_position(buffer + 12, waypt); waypt->creation_time = decode_datetime(buffer + 22); @@ -451,7 +451,7 @@ decode_trackpoint(const unsigned char *buffer) } static void -encode_trackpoint(const waypoint *waypt, unsigned serial, unsigned char *buffer) +encode_trackpoint(const waypoint* waypt, unsigned serial, unsigned char* buffer) { double x; double y; @@ -472,16 +472,16 @@ encode_trackpoint(const waypoint *waypt, unsigned serial, unsigned char *buffer) buffer[31] = 0x7e; } -static waypoint ** +static waypoint** serial_read_waypoints(void) { - waypoint **waypts = NULL; + waypoint** waypts = NULL; unsigned char information[32]; unsigned short total; unsigned short start; if (global_opts.masked_objective & RTEDATAMASK) { - waypts = xcalloc(MAX_WAYPOINTS, sizeof(waypoint *)); + waypts = (waypoint**) xcalloc(MAX_WAYPOINTS, sizeof(waypoint*)); } write_packet(PID_QRY_INFORMATION, NULL, 0); @@ -494,8 +494,8 @@ serial_read_waypoints(void) for (start = 0; start < total; start += 32) { unsigned short count = total - start; unsigned char payload[7]; - unsigned char *waypoints; - unsigned char *w; + unsigned char* waypoints; + unsigned char* w; if (count > 32) { count = 32; @@ -507,7 +507,7 @@ serial_read_waypoints(void) write_packet(PID_QRY_WAYPOINTS, payload, sizeof(payload)); - waypoints = xmalloc(count * 32); + waypoints = (unsigned char*) xmalloc(count * 32); read_packet(PID_DATA, waypoints, count * 32, count * 32, FALSE); @@ -531,7 +531,7 @@ serial_read_waypoints(void) } static unsigned int -serial_write_waypoint_packet(const waypoint *waypt) +serial_write_waypoint_packet(const waypoint* waypt) { unsigned char data[32]; unsigned char id[2]; @@ -546,7 +546,7 @@ serial_write_waypoint_packet(const waypoint *waypt) } static void -serial_write_waypoint(const waypoint *waypt) +serial_write_waypoint(const waypoint* waypt) { serial_write_waypoint_packet(waypt); } @@ -557,7 +557,7 @@ serial_read_track(void) unsigned char information[32]; unsigned int address; unsigned short total; - route_head *track; + route_head* track; write_packet(PID_QRY_INFORMATION, NULL, 0); read_packet(PID_DATA, information, @@ -573,8 +573,8 @@ serial_read_track(void) while (total > 0) { unsigned short count = total < MAX_READ_TRACKPOINTS ? total : MAX_READ_TRACKPOINTS; unsigned char payload[7]; - unsigned char *trackpoints; - unsigned char *t; + unsigned char* trackpoints; + unsigned char* t; le_write32(payload + 0, address); le_write16(payload + 4, count * 32); @@ -582,7 +582,7 @@ serial_read_track(void) write_packet(PID_READ_TRACKPOINTS, payload, sizeof(payload)); - trackpoints = xmalloc(count * 32); + trackpoints = (unsigned char*) xmalloc(count * 32); read_packet(PID_DATA, trackpoints, count * 32, count * 32, FALSE); write_packet(PID_ACK, NULL, 0); @@ -627,15 +627,15 @@ serial_write_track(void) } static void -serial_write_track_start(const route_head *track) +serial_write_track_start(const route_head* track) { - track_data = xmalloc(MAX_WRITE_TRACKPOINTS * 32); + track_data = (unsigned char*) xmalloc(MAX_WRITE_TRACKPOINTS * 32); track_data_ptr = track_data; track_data_end = track_data + MAX_WRITE_TRACKPOINTS * 32; } static void -serial_write_track_point(const waypoint *waypt) +serial_write_track_point(const waypoint* waypt) { if (track_data_ptr >= track_data_end) { serial_write_track(); @@ -647,7 +647,7 @@ serial_write_track_point(const waypoint *waypt) } static void -serial_write_track_end(const route_head *track) +serial_write_track_end(const route_head* track) { if (track_data_ptr > track_data) { serial_write_track(); @@ -657,7 +657,7 @@ serial_write_track_end(const route_head *track) } static void -serial_read_routes(waypoint **waypts) +serial_read_routes(waypoint** waypts) { unsigned char information[32]; unsigned char routec; @@ -673,7 +673,7 @@ serial_read_routes(waypoint **waypts) for (r = 0; r < routec; r++) { unsigned char payload[7]; unsigned char routedata[320]; - route_head *route; + route_head* route; int sr; le_write32(payload + 0, r); @@ -685,7 +685,7 @@ serial_read_routes(waypoint **waypts) route = route_head_alloc(); route->rte_num = routedata[2]; - route->rte_name = xstrdup((char *)routedata + 4); + route->rte_name = xstrdup((char*)routedata + 4); route_add_head(route); for (sr = 0; sr < MAX_SUBROUTES; sr++) { @@ -710,14 +710,14 @@ serial_read_routes(waypoint **waypts) } static void -serial_write_route_start(const route_head *route) +serial_write_route_start(const route_head* route) { - route_ids = xmalloc(route->rte_waypt_ct * sizeof(unsigned)); + route_ids = (unsigned int*) xmalloc(route->rte_waypt_ct * sizeof(unsigned)); route_id_ptr = 0; } static void -serial_write_route_point(const waypoint *waypt) +serial_write_route_point(const waypoint* waypt) { unsigned w; @@ -736,9 +736,9 @@ serial_write_route_point(const waypoint *waypt) } static void -serial_write_route_end(const route_head *route) +serial_write_route_end(const route_head* route) { - unsigned char *data; + unsigned char* data; unsigned src; unsigned sr; unsigned char id[1]; @@ -748,12 +748,12 @@ serial_write_route_end(const route_head *route) } src = (route_id_ptr + MAX_SUBROUTE_LENGTH) / MAX_SUBROUTE_LENGTH; - data = xmalloc(32 + src * 32); + data = (unsigned char*) xmalloc(32 + src * 32); le_write16(data + 0, 0x2000); data[2] = 0; data[3] = 0x20; - strncpy((char *)data + 4, route->rte_name, 6); + strncpy((char*)data + 4, route->rte_name, 6); data[18] = 0; data[19] = 0; le_write32(data + 20, 0); @@ -763,7 +763,7 @@ serial_write_route_end(const route_head *route) data[31] = 0x77; for (sr = 0; sr < src; sr++) { - unsigned char *srdata = data + 32 + 32 * sr; + unsigned char* srdata = data + 32 + 32 * sr; unsigned pt_offset = MAX_SUBROUTE_LENGTH * sr; unsigned pt; @@ -791,14 +791,14 @@ serial_write_route_end(const route_head *route) } static int -decode_sbp_usec(const unsigned char *buffer) +decode_sbp_usec(const unsigned char* buffer) { int msec = le_read16(buffer); return (msec % 1000) * 1000; } static time_t -decode_sbp_datetime_packed(const unsigned char *buffer) +decode_sbp_datetime_packed(const unsigned char* buffer) { /* * Packed_Date_Time_UTC: @@ -831,17 +831,17 @@ decode_sbp_datetime_packed(const unsigned char *buffer) } static void -decode_sbp_position(const unsigned char *buffer, waypoint *waypt) +decode_sbp_position(const unsigned char* buffer, waypoint* waypt) { waypt->latitude = le_read32(buffer + 0) / 10000000.0; waypt->longitude = le_read32(buffer + 4) / 10000000.0; waypt->altitude = le_read32(buffer + 8) / 100.0; } -waypoint * -navilink_decode_logpoint(const unsigned char *buffer) +waypoint* +navilink_decode_logpoint(const unsigned char* buffer) { - waypoint *waypt = NULL; + waypoint* waypt = NULL; waypt = waypt_new(); waypt->hdop = ((unsigned char)buffer[0]) * 0.2f; @@ -863,8 +863,8 @@ navilink_decode_logpoint(const unsigned char *buffer) * around), then seg2_addr and seg2_len will be zero. */ static void -read_datalog_info(unsigned int *seg1_addr, unsigned int *seg1_len, - unsigned int *seg2_addr, unsigned int *seg2_len) +read_datalog_info(unsigned int* seg1_addr, unsigned int* seg1_len, + unsigned int* seg2_addr, unsigned int* seg2_len) { unsigned char info[16]; unsigned int flash_start_addr; @@ -901,13 +901,13 @@ read_datalog_info(unsigned int *seg1_addr, unsigned int *seg1_len, } static void -read_datalog_records(route_head *track, +read_datalog_records(route_head* track, unsigned int start_addr, unsigned int len) { unsigned char logpoints[MAX_READ_LOGPOINTS * SBP_RECORD_LEN]; unsigned int logpoints_len; unsigned char payload[7]; - unsigned char *p; + unsigned char* p; /* The protocol only supports reading 256 logpoints at once, so * read small chunks until none left. */ @@ -934,7 +934,7 @@ read_datalog_records(route_head *track, static void serial_read_datalog(void) { - route_head *track; + route_head* track; unsigned int seg1_addr; unsigned int seg1_len; unsigned int seg2_addr; @@ -958,7 +958,7 @@ static void file_read(void) { unsigned char data[32]; - route_head *track = NULL; + route_head* track = NULL; while (gbfread(data, sizeof(data), 1, file_handle) == 1) { switch (le_read16(data)) { @@ -988,7 +988,7 @@ file_read(void) } static void -file_write_waypoint(const waypoint *waypt) +file_write_waypoint(const waypoint* waypt) { unsigned char data[32]; @@ -997,13 +997,13 @@ file_write_waypoint(const waypoint *waypt) } static void -file_write_track_start(const route_head *track) +file_write_track_start(const route_head* track) { track_serial = 1; } static void -file_write_track_point(const waypoint *waypt) +file_write_track_point(const waypoint* waypt) { unsigned char data[32]; @@ -1012,23 +1012,23 @@ file_write_track_point(const waypoint *waypt) } static void -file_write_track_end(const route_head *track) +file_write_track_end(const route_head* track) { } static void -file_write_route_start(const route_head *track) +file_write_route_start(const route_head* track) { fatal(MYNAME ": Can't write routes to a file\n"); } static void -file_write_route_point(const waypoint *waypt) +file_write_route_point(const waypoint* waypt) { } static void -file_write_route_end(const route_head *track) +file_write_route_end(const route_head* track) { } @@ -1086,7 +1086,7 @@ nuke(void) } static void -navilink_common_init(const char *name) +navilink_common_init(const char* name) { if (gbser_is_serial(name)) { if ((serial_handle = gbser_init(name)) == NULL) { @@ -1113,7 +1113,7 @@ navilink_common_init(const char *name) write_route_point = serial_write_route_point; write_route_end = serial_write_route_end; } else { - char *mode = operation == READING ? "r" : "w+"; + const char* mode = operation == READING ? "r" : "w+"; file_handle = gbfopen(name, mode, MYNAME); write_waypoint = file_write_waypoint; @@ -1129,14 +1129,14 @@ navilink_common_init(const char *name) } static void -navilink_rd_init(const char *name) +navilink_rd_init(const char* name) { operation = READING; navilink_common_init(name); } static void -navilink_wr_init(const char *name) +navilink_wr_init(const char* name) { operation = WRITING; navilink_common_init(name); @@ -1178,7 +1178,7 @@ navilink_read(void) } } else { if (serial_handle) { - waypoint **waypts = NULL; + waypoint** waypts = NULL; if (global_opts.masked_objective & (WPTDATAMASK|RTEDATAMASK)) { waypts = serial_read_waypoints(); diff --git a/gpsbabel/navilink.h b/gpsbabel/navilink.h index 58cf06002..c985f0528 100644 --- a/gpsbabel/navilink.h +++ b/gpsbabel/navilink.h @@ -29,11 +29,11 @@ #define SBP_RECORD_LEN 32 /* defined in navilink.c */ -waypoint *navilink_decode_logpoint(const unsigned char *buffer); -unsigned navilink_checksum_packet(const unsigned char *packet, unsigned length); +waypoint* navilink_decode_logpoint(const unsigned char* buffer); +unsigned navilink_checksum_packet(const unsigned char* packet, unsigned length); /* defined in sbn.c */ -int locosys_decode_file_id(char *header, size_t len); +int locosys_decode_file_id(char* header, size_t len); #ifdef THIS_IS_ONLY_FOR_REFERENCE diff --git a/gpsbabel/navitel.c b/gpsbabel/navitel.c index 32d625263..7407a3e27 100644 --- a/gpsbabel/navitel.c +++ b/gpsbabel/navitel.c @@ -26,7 +26,7 @@ #define MYNAME "navitel" -static gbfile *fin, *fout; +static gbfile* fin, *fout; static char new_track; static int trkpts; @@ -35,7 +35,7 @@ static int trkpts; *******************************************************************************/ static void -navitel_rd_init(const char *fname) +navitel_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); } @@ -50,14 +50,14 @@ static void navitel_read_track(void) { int points, i; - route_head *trk = NULL; + route_head* trk = NULL; points = gbfgetint32(fin); (void) gbfgetint32(fin); /* unknown */ for (i = 0; i < points; i++) { int lat, lon; - waypoint *wpt; + waypoint* wpt; lon = gbfgetint32(fin); lat = gbfgetint32(fin); @@ -75,7 +75,7 @@ navitel_read_track(void) } static void -navitel_wr_init(const char *fname) +navitel_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); } @@ -87,19 +87,19 @@ navitel_wr_deinit(void) } static void -navitel_enum_trkpts(const waypoint *wpt) +navitel_enum_trkpts(const waypoint* wpt) { trkpts++; } static void -navitel_disp_trk_head(const route_head *trk) +navitel_disp_trk_head(const route_head* trk) { new_track = 1; } static void -navitel_disp_trkpts(const waypoint *wpt) +navitel_disp_trkpts(const waypoint* wpt) { int lat, lon; @@ -136,7 +136,7 @@ ff_vecs_t navitel_trk_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, navitel_rd_init, diff --git a/gpsbabel/netstumbler.c b/gpsbabel/netstumbler.c index 43c84bb93..f4140dc3f 100644 --- a/gpsbabel/netstumbler.c +++ b/gpsbabel/netstumbler.c @@ -24,12 +24,12 @@ #include "csv_util.h" #include -static gbfile *file_in; -static char *nseicon = NULL; -static char *nsneicon = NULL; -static char *seicon = NULL; -static char *sneicon = NULL; -static char *snmac = NULL; +static gbfile* file_in; +static char* nseicon = NULL; +static char* nsneicon = NULL; +static char* seicon = NULL; +static char* sneicon = NULL; +static char* snmac = NULL; static int macstumbler; static void fix_netstumbler_dupes(void); @@ -62,7 +62,7 @@ arglist_t netstumbler_args[] = { }; static void -rd_init(const char *fname) +rd_init(const char* fname) { file_in = gbfopen(fname, "rb", MYNAME); macstumbler = 0; @@ -77,12 +77,12 @@ rd_deinit(void) static void data_read(void) { - char *ibuf; + char* ibuf; char ssid[2 + 32 + 2 + 1]; /* "( " + SSID + " )" + null */ char mac[2 + 17 + 2 + 1]; /* "( " + MAC + " )" + null */ char desc[sizeof ssid - 1 + 15 + 1]; /* room for channel/speed */ double lat = 0, lon = 0; - waypoint *wpt_tmp; + waypoint* wpt_tmp; int line_no = 0; int stealth_num = 0, whitespace_num = 0; long flags = 0; @@ -93,7 +93,7 @@ data_read(void) memset(&tm, 0, sizeof(tm)); while ((ibuf = gbfgetstr(file_in))) { - char *field; + char* field; int field_num, len, i, stealth = 0; if ((line++ == 0) && file_in->unicode) { @@ -249,15 +249,15 @@ data_read(void) typedef struct { unsigned long crc; - waypoint *wpt; + waypoint* wpt; } htable_t; static int -compare(const void *a, const void *b) +compare(const void* a, const void* b) { - unsigned long crc_a = ((const htable_t *)a)->crc; - unsigned long crc_b = ((const htable_t *)b)->crc; + unsigned long crc_a = ((const htable_t*)a)->crc; + unsigned long crc_b = ((const htable_t*)b)->crc; /* we can't just return crc_a - crc_b because the return type is * signed. @@ -274,8 +274,8 @@ compare(const void *a, const void *b) * to make the testo script happy. * */ - waypoint *wpt_a = ((const htable_t *)a)->wpt; - waypoint *wpt_b = ((const htable_t *)b)->wpt; + waypoint* wpt_a = ((const htable_t*)a)->wpt; + waypoint* wpt_b = ((const htable_t*)b)->wpt; return strcmp(wpt_a->description, wpt_b->description); } @@ -291,20 +291,20 @@ void fix_netstumbler_dupes(void) { int i, ct = waypt_count(), serial = 0; - htable_t *htable, *bh; - queue *elem, *tmp; + htable_t* htable, *bh; + queue* elem, *tmp; extern queue waypt_head; - const char *snptr; - char *tmp_sn; + const char* snptr; + char* tmp_sn; unsigned long last_crc; char ssid[32 + 5 + 1]; - htable = (htable_t *) xmalloc(ct * sizeof *htable); + htable = (htable_t*) xmalloc(ct * sizeof *htable); bh = htable; i = 0; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { - bh->wpt = (waypoint *) elem; + bh->wpt = (waypoint*) elem; snptr = bh->wpt->shortname; tmp_sn = strlower(xstrdup(snptr)); bh->crc = get_crc32(tmp_sn, strlen(snptr)); diff --git a/gpsbabel/nmea.c b/gpsbabel/nmea.c index f55077fda..f0bc5119a 100644 --- a/gpsbabel/nmea.c +++ b/gpsbabel/nmea.c @@ -147,15 +147,15 @@ enum { rm_file } read_mode; -static gbfile *file_in, *file_out; -static route_head *trk_head; +static gbfile* file_in, *file_out; +static route_head* trk_head; static short_handle mkshort_handle; static preferred_posn_type posn_type; static struct tm tm; -static waypoint *curr_waypt; -static waypoint *last_waypt; -static void * gbser_handle; -static const char *posn_fname; +static waypoint* curr_waypt; +static waypoint* last_waypt; +static void* gbser_handle; +static const char* posn_fname; static queue pcmpt_head; static int without_date; /* number of created trackpoints without a valid date */ @@ -163,17 +163,17 @@ static struct tm opt_tm; /* converted "date" parameter */ #define MYNAME "nmea" -static char *opt_gprmc; -static char *opt_gpgga; -static char *opt_gpvtg; -static char *opt_gpgsa; -static char *snlenopt; -static char *optdate; -static char *getposnarg; -static char *opt_sleep; -static char *opt_baud; -static char *opt_append; -static char *opt_gisteq; +static char* opt_gprmc; +static char* opt_gpgga; +static char* opt_gpvtg; +static char* opt_gpgsa; +static char* snlenopt; +static char* optdate; +static char* getposnarg; +static char* opt_sleep; +static char* opt_baud; +static char* opt_append; +static char* opt_gisteq; static long sleepus; static int getposn; @@ -185,8 +185,8 @@ static double last_read_time; /* Last timestamp of GGA or PRMC */ static int datum; static int had_checksum; -static waypoint * nmea_rd_posn(posn_status *); -static void nmea_rd_posn_init(const char *fname); +static waypoint* nmea_rd_posn(posn_status*); +static void nmea_rd_posn_init(const char* fname); arglist_t nmea_args[] = { {"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64" }, @@ -212,10 +212,10 @@ arglist_t nmea_args[] = { * Slightly different than the Magellan checksum fn. */ int -nmea_cksum(const char *const buf) +nmea_cksum(const char* const buf) { int x = 0 ; - const char *p; + const char* p; for (p = buf; *p; p++) { x ^= *p; @@ -224,7 +224,7 @@ nmea_cksum(const char *const buf) } static void -nmea_add_wpt(waypoint *wpt, route_head *trk) +nmea_add_wpt(waypoint* wpt, route_head* trk) { if (datum != DATUM_WGS84) { double lat, lon, alt; @@ -242,7 +242,7 @@ nmea_add_wpt(waypoint *wpt, route_head *trk) } static void -nmea_release_wpt(waypoint *wpt) +nmea_release_wpt(waypoint* wpt) { if (wpt && ((wpt->Q.next == NULL) || (wpt->Q.next == &wpt->Q))) { /* This waypoint isn't queued. @@ -253,7 +253,7 @@ nmea_release_wpt(waypoint *wpt) } static void -nmea_rd_init(const char *fname) +nmea_rd_init(const char* fname) { curr_waypt = NULL; last_waypt = NULL; @@ -277,7 +277,7 @@ nmea_rd_init(const char *fname) * it as one waypoint. */ if (getposn) { - waypoint *wpt; + waypoint* wpt; posn_status st; nmea_rd_posn_init(fname); wpt = nmea_rd_posn(&st); @@ -314,7 +314,7 @@ nmea_rd_deinit(void) } static void -nmea_wr_init(const char *portname) +nmea_wr_init(const char* portname) { CHECK_BOOL(opt_gprmc); CHECK_BOOL(opt_gpgga); @@ -353,7 +353,7 @@ nmea_wr_deinit(void) } static void -nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds) +nmea_set_waypoint_time(waypoint* wpt, struct tm* time, int microseconds) { if (time->tm_year == 0) { wpt->creation_time = ((((time_t)time->tm_hour * 60) + time->tm_min) * 60) + time->tm_sec; @@ -373,14 +373,14 @@ nmea_set_waypoint_time(waypoint *wpt, struct tm *time, int microseconds) } static void -gpgll_parse(char *ibuf) +gpgll_parse(char* ibuf) { double latdeg, lngdeg, microseconds; char lngdir, latdir; double hmsd; int hms; char valid = 0; - waypoint *waypt; + waypoint* waypt; if (trk_head == NULL) { trk_head = route_head_alloc(); @@ -426,7 +426,7 @@ gpgll_parse(char *ibuf) } static void -gpgga_parse(char *ibuf) +gpgga_parse(char* ibuf) { double latdeg, lngdeg; char lngdir, latdir; @@ -436,7 +436,7 @@ gpgga_parse(char *ibuf) int nsats = 0; double hdop; char altunits; - waypoint *waypt; + waypoint* waypt; double microseconds; if (trk_head == NULL) { @@ -507,7 +507,7 @@ gpgga_parse(char *ibuf) } static void -gprmc_parse(char *ibuf) +gprmc_parse(char* ibuf) { double latdeg, lngdeg; char lngdir, latdir; @@ -515,9 +515,9 @@ gprmc_parse(char *ibuf) char fix; unsigned int dmy; double speed,course; - waypoint *waypt; + waypoint* waypt; double microseconds; - char *dmybuf; + char* dmybuf; int i; if (trk_head == NULL) { @@ -617,9 +617,9 @@ gprmc_parse(char *ibuf) } static void -gpwpl_parse(char *ibuf) +gpwpl_parse(char* ibuf) { - waypoint *waypt; + waypoint* waypt; double latdeg, lngdeg; char latdir, lngdir; char sname[99]; @@ -647,7 +647,7 @@ gpwpl_parse(char *ibuf) } static void -gpzda_parse(char *ibuf) +gpzda_parse(char* ibuf) { double hms; int dd, mm, yy, lclhrs, lclmins; @@ -663,7 +663,7 @@ gpzda_parse(char *ibuf) } static void -gpgsa_parse(char *ibuf) +gpgsa_parse(char* ibuf) { char fixauto; char fix; @@ -720,7 +720,7 @@ gpgsa_parse(char *ibuf) } static void -gpvtg_parse(char *ibuf) +gpvtg_parse(char* ibuf) { float course; char ct; @@ -763,7 +763,7 @@ double pcmpt_deg(int d) } void -pcmpt_parse(char *ibuf) +pcmpt_parse(char* ibuf) { int i, j1, j2, j3, j4, j5, j6; int lat, lon; @@ -775,7 +775,7 @@ pcmpt_parse(char *ibuf) dmy = hms = 0; sscanf(ibuf,"$PCMPT,%d,%d,%d,%c,%f,%d,%[^,],%d,%f,%d,%f,%c,%d,%c,%d", - &j1, &j2, &j3, &altflag, &alt, &j4, (char *) &coords, + &j1, &j2, &j3, &altflag, &alt, &j4, (char*) &coords, &j5, &f1, &j6, &f2, &u1, &dmy, &u2, &hms); if (altflag == 'D' && curr_waypt && alt > 0) { @@ -819,8 +819,8 @@ pcmpt_parse(char *ibuf) nmea_set_waypoint_time(curr_waypt, &tm, 0); ENQUEUE_HEAD(&pcmpt_head, &curr_waypt->Q); } else { - queue *elem, *tmp; - route_head *trk_head; + queue* elem, *tmp; + route_head* trk_head; if (QUEUE_EMPTY(&pcmpt_head)) { return; @@ -834,22 +834,22 @@ pcmpt_parse(char *ibuf) trk_head = route_head_alloc(); track_add_head(trk_head); QUEUE_FOR_EACH(&pcmpt_head, elem, tmp) { - waypoint *wpt = (waypoint *) dequeue(elem); + waypoint* wpt = (waypoint*) dequeue(elem); nmea_add_wpt(wpt, trk_head); } } } static void -nmea_fix_timestamps(route_head *track) +nmea_fix_timestamps(route_head* track) { if ((trk_head == NULL) || (without_date == 0)) { return; } if (tm.tm_year == 0) { - queue *elem, *temp; - waypoint *prev = NULL; + queue* elem, *temp; + waypoint* prev = NULL; time_t delta_tm; if (optdate == NULL) { @@ -861,7 +861,7 @@ nmea_fix_timestamps(route_head *track) delta_tm = mkgmtime(&opt_tm); QUEUE_FOR_EACH(&track->waypoint_list, elem, temp) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; wpt->creation_time += delta_tm; if ((prev != NULL) && (prev->creation_time > wpt->creation_time)) { /* go over midnight ? */ @@ -872,7 +872,7 @@ nmea_fix_timestamps(route_head *track) } } else { time_t prev; - queue *elem; + queue* elem; tm.tm_hour = 23; /* last date found */ tm.tm_min = 59; @@ -883,7 +883,7 @@ nmea_fix_timestamps(route_head *track) /* go backward through the track and complete timestamps */ for (elem = QUEUE_LAST(&track->waypoint_list); elem != &track->waypoint_list; elem=elem->prev) { - waypoint *wpt = (waypoint *)elem; + waypoint* wpt = (waypoint*)elem; if (wpt->wpt_flags.fmt_use != 0) { time_t dt; @@ -902,11 +902,11 @@ nmea_fix_timestamps(route_head *track) } void -nmea_parse_one_line(char *ibuf) +nmea_parse_one_line(char* ibuf) { - char *ck; + char* ck; int ckval, ckcmp; - char *tbuf = lrtrim(ibuf); + char* tbuf = lrtrim(ibuf); /* * GISTEQ PhotoTracker (stupidly) puts a bogus field in front @@ -996,8 +996,8 @@ nmea_parse_one_line(char *ibuf) static void nmea_read(void) { - char *ibuf; - char *ck; + char* ibuf; + char* ck; double lt = -1; int line = -1; @@ -1015,7 +1015,7 @@ nmea_read(void) if (optdate) { memset(&opt_tm, 0, sizeof(opt_tm)); - ck = (char *)strptime(optdate, "%Y%m%d", &opt_tm); + ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm); if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) { fatal(MYNAME ": Invalid date \"%s\"!\n", optdate); } else if (opt_tm.tm_year < 70) { @@ -1026,7 +1026,7 @@ nmea_read(void) curr_waypt = NULL; while ((ibuf = gbfgetstr(file_in))) { - char *sdatum, *cx; + char* sdatum, *cx; line++; @@ -1047,7 +1047,7 @@ nmea_read(void) /* Check the GPS datum */ cx = strchr(&ibuf[12], '/'); if (cx != NULL) { - char *edatum; + char* edatum; sdatum = cx + 1; edatum = strchr(sdatum, '/'); if (edatum) { @@ -1076,7 +1076,7 @@ nmea_read(void) } void -nmea_rd_posn_init(const char *fname) +nmea_rd_posn_init(const char* fname) { if ((gbser_handle = gbser_init(fname)) != NULL) { read_mode = rm_serial; @@ -1096,7 +1096,7 @@ nmea_rd_posn_init(const char *fname) } static void -safe_print(int cnt, const char *b) +safe_print(int cnt, const char* b) { int i; for (i = 0; i < cnt; i++) { @@ -1112,7 +1112,7 @@ int hunt_sirf(void) { /* Try to place the common BR's first to speed searching */ static int br[] = {38400, 9600, 57600, 115200, 19200, 4800, -1}; - static int *brp = &br[0]; + static int* brp = &br[0]; char ibuf[1024]; for (brp = br; *brp > 0; brp++) { @@ -1149,8 +1149,8 @@ int hunt_sirf(void) return 0; } -static waypoint * -nmea_rd_posn(posn_status *posn_status) +static waypoint* +nmea_rd_posn(posn_status* posn_status) { char ibuf[1024]; static double lt = -1; @@ -1191,7 +1191,7 @@ nmea_rd_posn(posn_status *posn_status) nmea_parse_one_line(ibuf); if (lt != last_read_time) { if (last_read_time) { - waypoint *w = curr_waypt; + waypoint* w = curr_waypt; lt = last_read_time; curr_waypt = NULL; @@ -1204,11 +1204,11 @@ nmea_rd_posn(posn_status *posn_status) } static void -nmea_wayptpr(const waypoint *wpt) +nmea_wayptpr(const waypoint* wpt) { char obuf[200]; double lat,lon; - char *s; + char* s; int cksum; lat = degrees2ddmm(wpt->latitude); @@ -1236,19 +1236,19 @@ nmea_wayptpr(const waypoint *wpt) } void -nmea_track_init(const route_head *rte) +nmea_track_init(const route_head* rte) { last_time = -1; } void -nmea_trackpt_pr(const waypoint *wpt) +nmea_trackpt_pr(const waypoint* wpt) { char obuf[200]; char fix='0'; double lat,lon; int cksum; - struct tm *tm; + struct tm* tm; time_t hms; time_t ymd; @@ -1368,13 +1368,13 @@ nmea_write(void) } static void -nmea_wr_posn_init(const char *fname) +nmea_wr_posn_init(const char* fname) { nmea_wr_init(fname); } static void -nmea_wr_posn(waypoint *wpt) +nmea_wr_posn(waypoint* wpt) { nmea_trackpt_pr(wpt); } @@ -1416,7 +1416,7 @@ ff_vecs_t nmea_vecs = { */ static void -sirf_write(unsigned char *buf) +sirf_write(unsigned char* buf) { int i, chksum = 0; int len = buf[2] << 8 | buf[3]; diff --git a/gpsbabel/nmn4.c b/gpsbabel/nmn4.c index 8cc2c0efe..1aac5346d 100644 --- a/gpsbabel/nmn4.c +++ b/gpsbabel/nmn4.c @@ -33,12 +33,12 @@ #include #include -static gbfile *fin, *fout; +static gbfile* fin, *fout; static int curr_rte_num, target_rte_num; #define MYNAME "navigon" -static char *index_opt; +static char* index_opt; static arglist_t nmn4_args[] = { @@ -49,18 +49,18 @@ arglist_t nmn4_args[] = { /* helpers */ -static char * -nmn4_concat(char *arg0, ...) +static char* +nmn4_concat(char* arg0, ...) { va_list args; - char *src, *res; + char* src, *res; res = NULL; va_start(args, arg0); - src = (char *)arg0; + src = (char*)arg0; while (src != NULL) { - char *c = lrtrim(src); + char* c = lrtrim(src); if (*c != '\0') { if (res == NULL) { @@ -71,7 +71,7 @@ nmn4_concat(char *arg0, ...) } } xfree(src); - src = va_arg(args, char *); + src = va_arg(args, char*); } va_end(args); @@ -79,9 +79,9 @@ nmn4_concat(char *arg0, ...) } static void -nmn4_check_line(char *line) +nmn4_check_line(char* line) { - char *c = line; + char* c = line; int i = 0; while ((c = strchr(c, '|'))) { c++; @@ -94,14 +94,14 @@ nmn4_check_line(char *line) static void nmn4_read_data(void) { - char *buff; - char *str, *c; + char* buff; + char* str, *c; int column; int line = 0; - char *zip1, *zip2, *city, *street, *number; - route_head *route; - waypoint *wpt; + char* zip1, *zip2, *city, *street, *number; + route_head* route; + waypoint* wpt; route = route_head_alloc(); route_add_head(route); @@ -217,18 +217,18 @@ nmn4_read_data(void) } static void -nmn4_route_hdr(const route_head *route) +nmn4_route_hdr(const route_head* route) { curr_rte_num++; } static void -nmn4_route_tlr(const route_head *rte) +nmn4_route_tlr(const route_head* rte) { } static void -nmn4_write_waypt(const waypoint *wpt) +nmn4_write_waypt(const waypoint* wpt) { char city[128], street[128], zipc[32], number[32]; @@ -277,7 +277,7 @@ nmn4_write_data(void) /* %%% global callbacks %%% */ static void -nmn4_rd_init(const char *fname) +nmn4_rd_init(const char* fname) { fin = gbfopen(fname, "rb", MYNAME); } @@ -295,7 +295,7 @@ nmn4_read(void) } static void -nmn4_wr_init(const char *fname) +nmn4_wr_init(const char* fname) { fout = gbfopen(fname, "wb", MYNAME); } @@ -316,7 +316,7 @@ nmn4_write(void) ff_vecs_t nmn4_vecs = { ff_type_file, - { ff_cap_none, ff_cap_none, ff_cap_read | ff_cap_write}, + { ff_cap_none, ff_cap_none, (ff_cap)(ff_cap_read | ff_cap_write)}, nmn4_rd_init, nmn4_wr_init, nmn4_rd_deinit, diff --git a/gpsbabel/nukedata.c b/gpsbabel/nukedata.c index cc1fee05e..7dffca1c3 100644 --- a/gpsbabel/nukedata.c +++ b/gpsbabel/nukedata.c @@ -26,7 +26,7 @@ #if FILTERS_ENABLED #define MYNAME "nukedata" -static char *nukewpts, *nuketrks, *nukertes; +static char* nukewpts, *nuketrks, *nukertes; static arglist_t nuke_args[] = { diff --git a/gpsbabel/osm.c b/gpsbabel/osm.c index 3686321f4..0ed51f384 100644 --- a/gpsbabel/osm.c +++ b/gpsbabel/osm.c @@ -24,7 +24,7 @@ #include "avltree.h" #include "xmlgeneric.h" -static char *opt_tag, *opt_tagnd, *created_by; +static char* opt_tag, *opt_tagnd, *created_by; static arglist_t osm_args[] = { { "tag", &opt_tag, "Write additional way tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX }, @@ -35,19 +35,19 @@ static arglist_t osm_args[] = { #define MYNAME "osm" -static avltree_t *waypoints; /* AVL tree */ +static avltree_t* waypoints; /* AVL tree */ -static avltree_t *keys = NULL; -static avltree_t *values = NULL; -static avltree_t *icons = NULL; +static avltree_t* keys = NULL; +static avltree_t* values = NULL; +static avltree_t* icons = NULL; -static gbfile *fout; +static gbfile* fout; static int node_id; static int skip_rte; #if HAVE_LIBEXPAT -static route_head *rte; -static waypoint *wpt; +static route_head* rte; +static waypoint* wpt; static int wpt_loaded, rte_loaded; static xg_callback osm_node, osm_node_tag, osm_node_end; @@ -62,11 +62,11 @@ xg_tag_mapping osm_map[] = { { osm_way_nd, cb_start, "/osm/way/nd" }, { osm_way_tag, cb_start, "/osm/way/tag" }, { osm_way_end, cb_end, "/osm/way" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; #endif // HAVE_LIBEXPAT -static const char *osm_features[] = { +static const char* osm_features[] = { "- dummy -", /* 0 */ "aeroway", /* 1 */ "amenity", /* 2 */ @@ -92,8 +92,8 @@ static const char *osm_features[] = { typedef struct osm_icon_mapping_s { const int key; - const char *value; - const char *icon; + const char* value; + const char* icon; } osm_icon_mapping_t; @@ -405,7 +405,7 @@ static osm_icon_mapping_t osm_icon_mappings[] = { #if ! HAVE_LIBEXPAT void -osm_rd_init(const char *fname) +osm_rd_init(const char* fname) { fatal(MYNAME ": This build excluded \" MYNAME \" support because expat was not installed.\n"); } @@ -440,16 +440,16 @@ osm_features_init(void) buff[0] = osm_icon_mappings[i].key; strncpy(&buff[1], osm_icon_mappings[i].value, sizeof(buff) - 1); - avltree_insert(values, buff, (const void *)&osm_icon_mappings[i]); + avltree_insert(values, buff, (const void*)&osm_icon_mappings[i]); } } static char -osm_feature_ikey(const char *key) +osm_feature_ikey(const char* key) { int result; - const void *p; + const void* p; if (avltree_find(keys, key, &p)) { result = gb_ptr2int(p); @@ -461,17 +461,17 @@ osm_feature_ikey(const char *key) } -static char * -osm_feature_symbol(const int ikey, const char *value) +static char* +osm_feature_symbol(const int ikey, const char* value) { - char *result; + char* result; char buff[128]; - osm_icon_mapping_t *data; + osm_icon_mapping_t* data; buff[0] = ikey; strncpy(&buff[1], value, sizeof(buff) - 1); - if (avltree_find(values, buff, (void *)&data)) { + if (avltree_find(values, buff, (const void**)&data)) { result = xstrdup(data->icon); } else { xasprintf(&result, "%s:%s", osm_features[ikey], value); @@ -481,19 +481,19 @@ osm_feature_symbol(const int ikey, const char *value) } -static char * -osm_strip_html(const char *str) +static char* +osm_strip_html(const char* str) { utf_string utf; utf.is_html = 1; - utf.utfstring = (char *)str; + utf.utfstring = (char*)str; return strip_html(&utf); // util.c } static void -osm_node_end(const char *args, const char **unused) +osm_node_end(const char* args, const char** unused) { if (wpt) { if (wpt->wpt_flags.fmt_use) { @@ -507,16 +507,16 @@ osm_node_end(const char *args, const char **unused) static void -osm_node(const char *args, const char **attrv) +osm_node(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; wpt = waypt_new(); while (*avp) { if (strcmp(avp[0], "id") == 0) { xasprintf(&wpt->description, "osm-id %s", avp[1]); - if (! avltree_insert(waypoints, avp[1], (void *)wpt)) { + if (! avltree_insert(waypoints, avp[1], (void*)wpt)) { warning(MYNAME ": Duplicate osm-id %s!\n", avp[1]); } else { wpt->wpt_flags.fmt_use = 1; @@ -536,11 +536,11 @@ osm_node(const char *args, const char **attrv) static void -osm_node_tag(const char *args, const char **attrv) +osm_node_tag(const char* args, const char** attrv) { - const char **avp = &attrv[0]; - const char *key = "", *value = ""; - char *str; + const char** avp = &attrv[0]; + const char* key = "", *value = ""; + char* str; signed char ikey; while (*avp) { @@ -568,7 +568,7 @@ osm_node_tag(const char *args, const char **attrv) wpt->wpt_flags.icon_descr_is_dynamic = 1; } else if (strcmp(key, "note") == 0) { if (wpt->notes) { - char *tmp; + char* tmp; xasprintf(&tmp, "%s; %s", wpt->notes, str); xfree(wpt->notes); wpt->notes = tmp; @@ -602,9 +602,9 @@ osm_node_tag(const char *args, const char **attrv) static void -osm_way(const char *args, const char **attrv) +osm_way(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; rte = route_head_alloc(); @@ -617,14 +617,14 @@ osm_way(const char *args, const char **attrv) } static void -osm_way_nd(const char *args, const char **attrv) +osm_way_nd(const char* args, const char** attrv) { - const char **avp = &attrv[0]; + const char** avp = &attrv[0]; while (*avp) { if (strcmp(avp[0], "ref") == 0) { - waypoint *tmp; - if (avltree_find(waypoints, avp[1], (void *)&tmp)) { + waypoint* tmp; + if (avltree_find(waypoints, avp[1], (const void**)&tmp)) { tmp = waypt_dupe(tmp); route_add_wpt(rte, tmp); } else { @@ -636,11 +636,11 @@ osm_way_nd(const char *args, const char **attrv) } static void -osm_way_tag(const char *args, const char **attrv) +osm_way_tag(const char* args, const char** attrv) { - const char **avp = &attrv[0]; - const char *key = "", *value = ""; - char *str; + const char** avp = &attrv[0]; + const char* key = "", *value = ""; + char* str; while (*avp) { if (strcmp(avp[0], "k") == 0) { @@ -668,7 +668,7 @@ osm_way_tag(const char *args, const char **attrv) } static void -osm_way_end(const char *args, const char **unused) +osm_way_end(const char* args, const char** unused) { if (rte) { route_add_head(rte); @@ -677,7 +677,7 @@ osm_way_end(const char *args, const char **unused) } static void -osm_rd_init(const char *fname) +osm_rd_init(const char* fname) { wpt = NULL; rte = NULL; @@ -723,34 +723,34 @@ osm_init_icons(void) icons = avltree_init(AVLTREE_STATIC_KEYS, MYNAME); for (i = 0; osm_icon_mappings[i].value; i++) { - avltree_insert(icons, osm_icon_mappings[i].icon, (const void *)&osm_icon_mappings[i]); + avltree_insert(icons, osm_icon_mappings[i].icon, (const void*)&osm_icon_mappings[i]); } } static void -osm_write_tag(const char *key, const char *value) +osm_write_tag(const char* key, const char* value) { if (value && *value) { - char *str = xml_entitize(value); + char* str = xml_entitize(value); gbfprintf(fout, " \n", key, str); xfree(str); } } static void -osm_disp_feature(const waypoint *wpt) +osm_disp_feature(const waypoint* wpt) { - osm_icon_mapping_t *map; + osm_icon_mapping_t* map; - if (avltree_find(icons, wpt->icon_descr, (void *) &map)) { + if (avltree_find(icons, wpt->icon_descr, (const void**) &map)) { osm_write_tag(osm_features[map->key], map->value); } } static void -osm_write_opt_tag(const char *atag) +osm_write_opt_tag(const char* atag) { - char *tag, *cin, *ce; + char* tag, *cin, *ce; if (!atag) { return; @@ -760,7 +760,7 @@ osm_write_opt_tag(const char *atag) ce = cin + strlen(cin); while (cin < ce) { - char *sc, *dp; + char* sc, *dp; if ((sc = strchr(cin, ';'))) { *sc = '\0'; @@ -777,29 +777,29 @@ osm_write_opt_tag(const char *atag) } static void -osm_release_ids(const waypoint *wpt) +osm_release_ids(const waypoint* wpt) { if (wpt && wpt->extra_data) { - waypoint *tmp = (waypoint *)wpt; + waypoint* tmp = (waypoint*)wpt; xfree(tmp->extra_data); tmp->extra_data = NULL; } } static void -osm_waypt_disp(const waypoint *wpt) +osm_waypt_disp(const waypoint* wpt) { - char *buff; + char* buff; xasprintf(&buff, "%s\01%f\01%f", (wpt->shortname) ? wpt->shortname : "", wpt->latitude, wpt->longitude); - if (avltree_insert(waypoints, buff, (const void *) wpt)) { - int *id; + if (avltree_insert(waypoints, buff, (const void*) wpt)) { + int* id; - id = xmalloc(sizeof(*id)); + id = (int*) xmalloc(sizeof(*id)); *id = --node_id; - ((waypoint *)(wpt))->extra_data = id; + ((waypoint*)(wpt))->extra_data = id; gbfprintf(fout, " latitude, wpt->longitude); if (wpt->creation_time) { @@ -867,7 +867,7 @@ osm_waypt_disp(const waypoint *wpt) } static void -osm_rte_disp_head(const route_head *rte) +osm_rte_disp_head(const route_head* rte) { skip_rte = (rte->rte_waypt_ct <= 0); @@ -879,10 +879,10 @@ osm_rte_disp_head(const route_head *rte) } static void -osm_rtept_disp(const waypoint *wpt_ref) +osm_rtept_disp(const waypoint* wpt_ref) { - char *buff; - waypoint *wpt; + char* buff; + waypoint* wpt; if (skip_rte) { return; @@ -891,8 +891,8 @@ osm_rtept_disp(const waypoint *wpt_ref) xasprintf(&buff, "%s\01%f\01%f", (wpt_ref->shortname) ? wpt_ref->shortname : "", wpt_ref->latitude, wpt_ref->longitude); - if (avltree_find(waypoints, buff, (void *) &wpt)) { - int *id = wpt->extra_data; + if (avltree_find(waypoints, buff, (const void**) &wpt)) { + int* id = (int*) wpt->extra_data; gbfprintf(fout, " \n", *id); } @@ -900,7 +900,7 @@ osm_rtept_disp(const waypoint *wpt_ref) } static void -osm_rte_disp_trail(const route_head *rte) +osm_rte_disp_trail(const route_head* rte) { if (skip_rte) { return; @@ -928,7 +928,7 @@ osm_rte_disp_trail(const route_head *rte) /*-----------------------------------------------------------------------------*/ static void -osm_wr_init(const char *fname) +osm_wr_init(const char* fname) { fout = gbfopen(fname, "w", MYNAME); @@ -988,9 +988,9 @@ osm_exit(void) ff_vecs_t osm_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_write /* tracks */, - ff_cap_read | ff_cap_write /* routes */, + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */, }, osm_rd_init, osm_wr_init, diff --git a/gpsbabel/overlay.c b/gpsbabel/overlay.c index 6432c6a1b..17166b7f2 100644 --- a/gpsbabel/overlay.c +++ b/gpsbabel/overlay.c @@ -38,8 +38,8 @@ static short_handle mkshort_handle; #undef MAPNAME #define MAPNAME "Top. Karte 1:50.000 Nieders." -static gbfile *fpout; -static gbfile *fpin; +static gbfile* fpout; +static gbfile* fpin; static int govl_cnt; static double govl_sum_e=0.0; static double govl_sum_n=0.0; @@ -52,16 +52,16 @@ static double govl_last_north=0.0; */ static int govl_col=1; -static char *govl_col_s = NULL; +static char* govl_col_s = NULL; static int govl_size=101; -static char *govl_size_s = NULL; +static char* govl_size_s = NULL; static double govl_dir=0.0; -static char *govl_mapname = NULL; +static char* govl_mapname = NULL; static int govl_zoomfc = 100; -static char *govl_zoomfc_s = NULL; +static char* govl_zoomfc_s = NULL; static int govl_dimmfc = 100; -static char *govl_dimmfc_s = NULL; +static char* govl_dimmfc_s = NULL; static int govl_txtcol=1; @@ -69,12 +69,12 @@ static int govl_txtsize=120; static int govl_font=1; static int govl_txttrans=0; -static char *govl_txtcol_s = NULL; -static char *govl_txtsize_s = NULL; -static char *govl_font_s = NULL; -static char *govl_txttrans_s = NULL; +static char* govl_txtcol_s = NULL; +static char* govl_txtsize_s = NULL; +static char* govl_font_s = NULL; +static char* govl_txttrans_s = NULL; -static char *govl_file_s = NULL; +static char* govl_file_s = NULL; static arglist_t ovl_args[] = { { @@ -121,7 +121,7 @@ static arglist_t ovl_args[] = { }; -static char *Keywords[]= { +static char* Keywords[]= { "Typ", "Group", "Col", @@ -158,7 +158,7 @@ static char *Keywords[]= { #define KEY_TRANS 14 #define KEY_TRANSBYTE 15 -static int isKeyword(char *str,char **keys) +static int isKeyword(char* str,char** keys) { int i; @@ -172,7 +172,7 @@ static int isKeyword(char *str,char **keys) /*----------------------------------------------*/ static -void ovl_rd_init(char const *fname) +void ovl_rd_init(char const* fname) { fpin = gbfopen(fname, "r", MYNAME); } @@ -186,11 +186,11 @@ void ovl_rd_init(char const *fname) static struct _group { int group; - char *name; -} *groups; + char* name; +}* groups; static int groups_cnt; -static void ovl_add_group(int aktgrp,char *akttxt) +static void ovl_add_group(int aktgrp,char* akttxt) { int i; @@ -199,26 +199,26 @@ static void ovl_add_group(int aktgrp,char *akttxt) i++; } if (i==groups_cnt) { - groups = (struct _group *) xrealloc(groups,(groups_cnt+1)*sizeof(struct _group)); + groups = (struct _group*) xrealloc(groups,(groups_cnt+1)*sizeof(struct _group)); groups[i].group = aktgrp; groups[i].name = NULL; groups_cnt++; } - groups[i].name = (char *) xrealloc(groups[i].name,(strlen(akttxt)+1)*sizeof(char)); + groups[i].name = (char*) xrealloc(groups[i].name,(strlen(akttxt)+1)*sizeof(char)); strcpy(groups[i].name,akttxt); } /* The name of route is stored in a 'Text'-symbol with identical 'Group'-number. */ -static void route_add_name(const route_head *hd) +static void route_add_name(const route_head* hd) { int grp; int i; char name[MAXLINE]; - route_head *route; + route_head* route; - route = (route_head *) hd; + route = (route_head*) hd; grp = atoi(route->rte_name); i = 0; while (irte_name = (char *) xrealloc(route->rte_name,(strlen(name)+1)*sizeof(char)); + route->rte_name = (char*) xrealloc(route->rte_name,(strlen(name)+1)*sizeof(char)); strcpy(route->rte_name,name); } static void ovl_read(void) { - char *line; + char* line; int isSection; int aktTyp,aktCol,aktSize,aktArt,aktGroup; int aktArea,aktWidth,aktHeight,aktTrans,aktTransByte,aktDir; double aktX,aktY; - char *aktPath; - char *aktText; - char *pstr; + char* aktPath; + char* aktText; + char* pstr; int keyw,i; double rwert; - route_head *route_head = NULL; - waypoint *wpt; + route_head* route_head = NULL; + waypoint* wpt; int sym_cnt; int lineno = 0; @@ -415,12 +415,12 @@ static void ovl_rd_deinit(void) } /*------------------------------------------*/ -void ovl_read_parameter(char *fname) +void ovl_read_parameter(char* fname) { - gbfile *fpin; - arglist_t *p; - char *str; - char *pstr; + gbfile* fpin; + arglist_t* p; + char* str; + char* pstr; fpin = gbfopen(fname, "r", MYNAME); if (fpin!=NULL) { @@ -449,7 +449,7 @@ void ovl_read_parameter(char *fname) } } -static void ovl_wr_init(const char *fname) +static void ovl_wr_init(const char* fname) { fpout = gbfopen(fname, "w", MYNAME); govl_sum_n = 0.0; @@ -509,7 +509,7 @@ static void ovl_wr_deinit(void) gbfclose(fpout); } -static void symbol_init(const route_head *hd) +static void symbol_init(const route_head* hd) { gbfprintf(fpout,"[Symbol %d]\n",govl_symbol_cnt+1); gbfprintf(fpout,"Typ=3\n"); // Linie @@ -524,7 +524,7 @@ static void symbol_init(const route_head *hd) govl_group_cnt++; } -static void symbol_text(double east,double north,char *text,int group) +static void symbol_text(double east,double north,char* text,int group) { gbfprintf(fpout,"[Symbol %d]\n",govl_symbol_cnt+1); gbfprintf(fpout,"Typ=2\n"); // Text @@ -541,7 +541,7 @@ static void symbol_text(double east,double north,char *text,int group) govl_symbol_cnt++; } -static void symbol_point(const waypoint *wpt) +static void symbol_point(const waypoint* wpt) { double east,north; @@ -560,10 +560,10 @@ static void symbol_point(const waypoint *wpt) } -static void symbol_deinit(const route_head *hd) +static void symbol_deinit(const route_head* hd) { - queue *elem, *tmp; - waypoint *waypointp; + queue* elem, *tmp; + waypoint* waypointp; int i; double lat1,lon1,lat2,lon2; double lats,lons,late,lone; @@ -574,7 +574,7 @@ static void symbol_deinit(const route_head *hd) dist = 0.0; i = 0; QUEUE_FOR_EACH(&(hd->waypoint_list), elem, tmp) { - waypointp = (waypoint *) elem; + waypointp = (waypoint*) elem; lat2 = RAD(waypointp->latitude); lon2 = RAD(waypointp->longitude); if (i) { @@ -594,7 +594,7 @@ static void symbol_deinit(const route_head *hd) i = 0; elem = QUEUE_FIRST(&(hd->waypoint_list)); while (elem!=&(hd->waypoint_list) && ddlatitude); lon2 = RAD(waypointp->longitude); if (i) { @@ -625,10 +625,10 @@ static void symbol_deinit(const route_head *hd) govl_dir = 0.0; // restore } -static void overlay_waypt_pr(const waypoint *waypointp) +static void overlay_waypt_pr(const waypoint* waypointp) { - const char *oname; - char *odesc; + const char* oname; + char* odesc; /* * Desparation time, try very hard to get a good shortname diff --git a/gpsbabel/ozi.c b/gpsbabel/ozi.c index 0aee09616..056f53e36 100644 --- a/gpsbabel/ozi.c +++ b/gpsbabel/ozi.c @@ -119,7 +119,7 @@ static void ozi_copy_fsdata(ozi_fsdata **dest, ozi_fsdata *src) { /* No strings to mess with. Straight forward copy. */ - *dest = (void *)xmalloc(sizeof(*src)); + *dest = (ozi_fsdata *)xmalloc(sizeof(*src)); **dest = *src; (*dest)->fs.next = NULL; } @@ -134,7 +134,7 @@ static ozi_fsdata * ozi_alloc_fsdata(void) { - ozi_fsdata *fsdata = xcalloc(sizeof(*fsdata), 1); + ozi_fsdata *fsdata = (ozi_fsdata*) xcalloc(sizeof(*fsdata), 1); fsdata->fs.type = FS_OZI; fsdata->fs.copy = (fs_copy) ozi_copy_fsdata; fsdata->fs.destroy = ozi_free_fsdata; diff --git a/gpsbabel/pdbfile.h b/gpsbabel/pdbfile.h index b93159479..e8a409f80 100644 --- a/gpsbabel/pdbfile.h +++ b/gpsbabel/pdbfile.h @@ -44,12 +44,12 @@ typedef struct pdbrec_s { gbuint32 id; gbuint8 category; gbuint8 flags; - char *data; - struct pdbrec_s *next; + char* data; + struct pdbrec_s* next; } pdbrec_t; typedef struct { - gbfile *file; + gbfile* file; char mode; /* file-mode: 1 = read / 2 = write */ char name[PDB_DBNAMELEN + 1]; /* database name */ gbuint16 attr; /* attributes */ @@ -64,21 +64,21 @@ typedef struct { gbuint32 type; gbuint32 uid; gbuint16 rec_ct; - struct pdbrec_s *rec_list; - struct pdbrec_s *rec_curr; - void *appinfo; + struct pdbrec_s* rec_list; + struct pdbrec_s* rec_curr; + void* appinfo; int appinfo_len; } pdbfile; -pdbfile *pdb_open(const char *filename, const char *module); -pdbfile *pdb_create(const char *filename, const char *module); -void pdb_close(pdbfile *file); -int pdb_eof(pdbfile *fin); -void pdb_rewind(pdbfile *fin); -int pdb_read_rec(pdbfile *fin, gbuint8 *flags, gbuint8 *category, gbuint32 *rec_id, void **data); -int pdb_read_rec_by_id(pdbfile *fin, const gbuint32 rec_id, gbuint8 *flags, gbuint8 *category, void **data); -void pdb_write_rec(pdbfile *fout, const gbuint8 flags, const gbuint8 category, const gbuint32 rec_id, const void *data, const gbuint32 size); +pdbfile* pdb_open(const char* filename, const char* module); +pdbfile* pdb_create(const char* filename, const char* module); +void pdb_close(pdbfile* file); +int pdb_eof(pdbfile* fin); +void pdb_rewind(pdbfile* fin); +int pdb_read_rec(pdbfile* fin, gbuint8* flags, gbuint8* category, gbuint32* rec_id, void** data); +int pdb_read_rec_by_id(pdbfile* fin, const gbuint32 rec_id, gbuint8* flags, gbuint8* category, void** data); +void pdb_write_rec(pdbfile* fout, const gbuint8 flags, const gbuint8 category, const gbuint32 rec_id, const void* data, const gbuint32 size); #endif #endif diff --git a/gpsbabel/pocketfms_bc.c b/gpsbabel/pocketfms_bc.c index 64cb34f22..fb71eb1a2 100755 --- a/gpsbabel/pocketfms_bc.c +++ b/gpsbabel/pocketfms_bc.c @@ -114,7 +114,7 @@ read_tracks(void) wpt->pdop = le_read_float(&bc.espe); wpt->course = le_read_float(&bc.course); wpt->speed = le_read_float(&bc.speed); - wpt->fix = le_readu16(&bc.fix) - 1; + wpt->fix = (fix_type) le_readu16(&bc.fix) - 1; track_add_wpt(trk_head, wpt); } @@ -176,7 +176,7 @@ ff_vecs_t pocketfms_bc_vecs = { ff_type_file, { ff_cap_none, /* waypoints */ - ff_cap_read | ff_cap_write, /* tracks */ + (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */ ff_cap_none /* routes */ }, rd_init, diff --git a/gpsbabel/pocketfms_fp.c b/gpsbabel/pocketfms_fp.c index 97dafd003..c25b1c4c0 100755 --- a/gpsbabel/pocketfms_fp.c +++ b/gpsbabel/pocketfms_fp.c @@ -44,7 +44,7 @@ static xg_tag_mapping gl_map[] = { { wpt_to_elev, cb_cdata, "/PocketFMSFlightplan/LIB/ToPoint/Elevation" }, { wpt_altitude, cb_start, "/PocketFMSFlightplan/LIB/PlannedAltitude" }, { wpt_e, cb_end, "/PocketFMSFlightplan/LIB" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; static void diff --git a/gpsbabel/pocketfms_wp.c b/gpsbabel/pocketfms_wp.c index b5428bc98..8f53fed63 100755 --- a/gpsbabel/pocketfms_wp.c +++ b/gpsbabel/pocketfms_wp.c @@ -110,7 +110,7 @@ wr_deinit(void) ff_vecs_t pocketfms_wp_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write, /* waypoints */ + (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */ ff_cap_none, /* tracks */ ff_cap_none, /* routes */ }, diff --git a/gpsbabel/queue.h b/gpsbabel/queue.h index a72efabc6..48771efbc 100644 --- a/gpsbabel/queue.h +++ b/gpsbabel/queue.h @@ -20,14 +20,14 @@ */ typedef struct queue { - struct queue *next; - struct queue *prev; + struct queue* next; + struct queue* prev; } queue; -void enqueue(queue *new_el, queue *old); -queue * dequeue(queue *element); +void enqueue(queue* new_el, queue* old); +queue* dequeue(queue* element); -void sortqueue(queue *qh, int (*cmp)(const queue *, const queue *)); +void sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)); #define QUEUE_INIT(head) (head)->next = ((head)->prev = head) #define QUEUE_FIRST(head) ((head)->next) diff --git a/gpsbabel/random.c b/gpsbabel/random.c index add054f37..20f62ffd6 100644 --- a/gpsbabel/random.c +++ b/gpsbabel/random.c @@ -62,7 +62,7 @@ rand_str(const int maxlen, const char *fmt) len = rand_int(maxlen) + 1; - res = xmalloc(len + 1); + res = (char*) xmalloc(len + 1); res[len] = '\0'; for (i = 0; i < len; i++) { @@ -176,7 +176,7 @@ random_read(void) wpt->hdop = (rand_int(500)) / 10.0; wpt->vdop = (rand_int(500)) / 10.0; wpt->pdop = (rand_int(500)) / 10.0; - wpt->fix = rand_int(6) - 1; + wpt->fix = (fix_type)(rand_int(6) - 1); if RND(3) { wpt->cadence = rand_int(255); } diff --git a/gpsbabel/raymarine.c b/gpsbabel/raymarine.c index c24e17347..8b426ac57 100644 --- a/gpsbabel/raymarine.c +++ b/gpsbabel/raymarine.c @@ -301,9 +301,9 @@ register_waypt(const waypoint *ref, const char is_rtept) if (waypt_table_ct >= waypt_table_sz) { waypt_table_sz += 32; if (waypt_table) { - waypt_table = (void *) xrealloc(waypt_table, waypt_table_sz * sizeof(wpt)); + waypt_table = (waypoint**) xrealloc(waypt_table, waypt_table_sz * sizeof(wpt)); } else { - waypt_table = (void *) xmalloc(waypt_table_sz * sizeof(wpt)); + waypt_table = (waypoint**) xmalloc(waypt_table_sz * sizeof(wpt)); } } @@ -521,9 +521,9 @@ raymarine_write(void) ff_vecs_t raymarine_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, - ff_cap_read | ff_cap_write /* routes */, + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */, }, raymarine_rd_init, raymarine_wr_init, diff --git a/gpsbabel/saroute.c b/gpsbabel/saroute.c index 24e3460c9..f8e6205e8 100644 --- a/gpsbabel/saroute.c +++ b/gpsbabel/saroute.c @@ -226,9 +226,9 @@ my_read(void) addrlen = le_read16(&record[obase]); cmtlen = le_read16(&record[obase+2+addrlen]); - wpt_tmp->shortname = xmalloc(addrlen+1); + wpt_tmp->shortname = (char*) xmalloc(addrlen+1); wpt_tmp->shortname[addrlen]='\0'; - wpt_tmp->notes = xmalloc(cmtlen+1); + wpt_tmp->notes = (char *) xmalloc(cmtlen+1); wpt_tmp->notes[cmtlen] = '\0'; memcpy(wpt_tmp->notes, record+obase+4+addrlen, @@ -237,7 +237,7 @@ my_read(void) record+obase+2, addrlen); } else { - wpt_tmp->shortname = xmalloc(7); + wpt_tmp->shortname = (char*) xmalloc(7); sprintf(wpt_tmp->shortname, "\\%5.5x", serial++); } if (control == 2) { @@ -361,7 +361,7 @@ my_read(void) wpt_tmp->latitude = lat; wpt_tmp->longitude = -lon; if (stringlen && ((coordcount>1) || count)) { - wpt_tmp->shortname = xmalloc(stringlen+1); + wpt_tmp->shortname = (char *) xmalloc(stringlen+1); wpt_tmp->shortname[stringlen] = '\0'; memcpy(wpt_tmp->shortname, ((char *)record)+2, diff --git a/gpsbabel/sbn.c b/gpsbabel/sbn.c index b9da8e998..ffd5c0319 100644 --- a/gpsbabel/sbn.c +++ b/gpsbabel/sbn.c @@ -91,7 +91,7 @@ read_packet(int *type, void *payload, size_t max_len) data_size = size + 4; /* data_size can be up to about 64k */ - data = xmalloc(data_size); + data = (unsigned char *) xmalloc(data_size); if (gbfread(data, data_size, 1, file_handle) != 1) { fatal(MYNAME ": Format error: could not read %d bytes.\n", diff --git a/gpsbabel/session.h b/gpsbabel/session.h index 134f0ca21..f8b61624a 100644 --- a/gpsbabel/session.h +++ b/gpsbabel/session.h @@ -25,14 +25,14 @@ typedef struct { queue Q; int id; - char *name; + char* name; } category_t; typedef struct { queue Q; int nr; - const char *name; /* in normal case the name of a format */ - char *filename; /* used file within format */ + const char* name; /* in normal case the name of a format */ + char* filename; /* used file within format */ int category_ct; int unknown_category_ct; /* added without id */ queue category_list; @@ -41,8 +41,8 @@ typedef struct { void session_init(void); void session_exit(void); -void start_session(const char *name, const char *filename); -session_t *curr_session(void); +void start_session(const char* name, const char* filename); +session_t* curr_session(void); /* in work int session_add_category(const char *name, const int id); diff --git a/gpsbabel/skytraq.c b/gpsbabel/skytraq.c index 9299ed79b..bf6af7ff3 100644 --- a/gpsbabel/skytraq.c +++ b/gpsbabel/skytraq.c @@ -929,7 +929,7 @@ skytraq_read_tracks(void) } } - buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6); + buffer = (gbuint8*) xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6); // m.ad/090930: removed code that tried reducing read_at_once if necessary since doesn't work with xmalloc if (opt_dump_file) { @@ -1207,7 +1207,7 @@ file_read(void) gbuint8 *buffer; state_init(&st); - buffer = xmalloc(SECTOR_SIZE); + buffer = (gbuint8*) xmalloc(SECTOR_SIZE); if (opt_first_sector_val > 0) { db(4, MYNAME ": Seeking to first-sector index %i\n", opt_first_sector_val*SECTOR_SIZE); diff --git a/gpsbabel/strptime.h b/gpsbabel/strptime.h index 3270703cc..62a0c61df 100644 --- a/gpsbabel/strptime.h +++ b/gpsbabel/strptime.h @@ -27,7 +27,7 @@ /* * Version of "strptime()", for the benefit of OSes that don't have it. */ -extern char *strptime(const char *, const char *, struct tm *); +extern char* strptime(const char*, const char*, struct tm*); #endif diff --git a/gpsbabel/tef_xml.c b/gpsbabel/tef_xml.c index 528ace1e0..943777185 100644 --- a/gpsbabel/tef_xml.c +++ b/gpsbabel/tef_xml.c @@ -86,7 +86,7 @@ xg_tag_mapping tef_xml_map[] = { { tef_point, cb_start, "/TEF/WaypointList/Item/Point" }, { tef_item_end, cb_end, "/TEF/WaypointList/Item" }, { tef_list_end, cb_end, "/TEF/WaypointList" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; diff --git a/gpsbabel/teletype.c b/gpsbabel/teletype.c index 476f8fb5c..c91d3bbf1 100644 --- a/gpsbabel/teletype.c +++ b/gpsbabel/teletype.c @@ -73,7 +73,7 @@ teletype_read(void) if (1) { // need bit value of NEWFORMAT int len = gbfgetuint16(fin); // probably could treat as a pascal string - char *junk = xmalloc(len); + char *junk = (char*) xmalloc(len); gbfread(junk, len, 1, fin); xfree(junk); } @@ -124,7 +124,7 @@ teletype_exit(void) /* optional */ ff_vecs_t teletype_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, ff_cap_none /* tracks */, ff_cap_none /* routes */ }, diff --git a/gpsbabel/tomtom.c b/gpsbabel/tomtom.c index d79a76cf4..0fcbb4c3e 100644 --- a/gpsbabel/tomtom.c +++ b/gpsbabel/tomtom.c @@ -83,11 +83,11 @@ wr_deinit(void) char * decode_8(int sz, const unsigned char *inbuf) { - static const char encoding_8[32] = "X. SaerionstldchumgpbkfzvACBMPG-"; + static const char encoding_8[] = "X. SaerionstldchumgpbkfzvACBMPG-"; static const int encoding_8_high[8] = {0x2,0x3,0x4,0x5,0x6,0x7,0xe,0xf}; // Maximally sized for laziness. - char *rval = xmalloc(sz * 3 + 1); + char *rval = (char *) xmalloc(sz * 3 + 1); char *out = rval; int i; @@ -248,8 +248,8 @@ static int compare_lat(const void *a, const void *b) { - const struct hdr *wa = a; - const struct hdr *wb = b; + const struct hdr *wa = (const struct hdr*) a; + const struct hdr *wb = (const struct hdr*) b; double difference = wa->wpt->latitude - wb->wpt->latitude; if (difference < 0) { @@ -268,8 +268,8 @@ static int compare_lon(const void *a, const void *b) { - const struct hdr *wa = a; - const struct hdr *wb = b; + const struct hdr *wa = (const struct hdr*)a; + const struct hdr *wb = (const struct hdr*)b; double difference = wa->wpt->longitude - wb->wpt->longitude; if (difference < 0) { @@ -429,7 +429,7 @@ data_write(void) double maxlat = -200; struct blockheader *blocks = NULL; - htable = xmalloc(ct * sizeof(*htable)); + htable = (struct hdr*) xmalloc(ct * sizeof(*htable)); bh = htable; QUEUE_FOR_EACH(&waypt_head, elem, tmp) { diff --git a/gpsbabel/tpo.c b/gpsbabel/tpo.c index 640f4943d..61ff7c719 100644 --- a/gpsbabel/tpo.c +++ b/gpsbabel/tpo.c @@ -142,7 +142,7 @@ tpo_check_version_string() /* read the id string */ gbfread(&string_size, 1, 1, tpo_file_in); - string_buffer = xmalloc(string_size+1); + string_buffer = (char *) xmalloc(string_size+1); gbfread(string_buffer, 1, string_size, tpo_file_in); /* terminate the string */ @@ -175,7 +175,7 @@ static void tpo_dump_header_bytes(int header_size) { int i; - unsigned char* buffer = (unsigned char*)xmalloc(header_size); + unsigned char* buffer = (unsigned char*)(char *) xmalloc(header_size); gbfread(buffer, 1, header_size, tpo_file_in); @@ -341,8 +341,8 @@ void tpo_read_2_x(void) waypoint_count = gbfgetint16(tpo_file_in); /* allocate temporary memory for the waypoint deltas */ - lon_delta = (short*)xmalloc(waypoint_count * sizeof(short)); - lat_delta = (short*)xmalloc(waypoint_count * sizeof(short)); + lon_delta = (short*)(char *) xmalloc(waypoint_count * sizeof(short)); + lat_delta = (short*)(char *) xmalloc(waypoint_count * sizeof(short)); for (j=0; jrte_name = track_name; @@ -617,7 +617,7 @@ void tpo_process_tracks(void) // proper place for the next track. // Read the track bytes into a buffer - buf = xmalloc(track_byte_count); + buf = (unsigned char *) xmalloc(track_byte_count); gbfread(buf, 1, track_byte_count, tpo_file_in); latscale=0; @@ -757,7 +757,7 @@ void tpo_process_waypoints(void) // Fetch storage for the waypoint index (needed later for // routes) - tpo_wp_index = (waypoint **)xmalloc(sizeof(waypoint *) * waypoint_count); + tpo_wp_index = (waypoint **)(char *) xmalloc(sizeof(waypoint *) * waypoint_count); if (waypoint_count == 0) { return; @@ -785,12 +785,12 @@ void tpo_process_waypoints(void) name_length = tpo_read_int(); //printf("\nName Length: %d\n", name_length); if (name_length) { - waypoint_name = xmalloc(name_length+1); + waypoint_name = (char *) xmalloc(name_length+1); waypoint_name[0] = '\0'; gbfread(waypoint_name, 1, name_length, tpo_file_in); waypoint_name[name_length] = '\0'; // Terminator } else { // Assign a generic waypoint name - waypoint_name = xmalloc(15); + waypoint_name = (char *) xmalloc(15); sprintf(waypoint_name, "WPT %d", ii+1); } //printf("\tWaypoint Name: %s\n", waypoint_name); @@ -822,7 +822,7 @@ void tpo_process_waypoints(void) if (name_length) { char *comment; - comment = xmalloc(name_length+1); + comment = (char *) xmalloc(name_length+1); comment[0] = '\0'; gbfread(comment, 1, name_length, tpo_file_in); comment[name_length] = '\0'; // Terminator @@ -913,7 +913,7 @@ void tpo_process_map_notes(void) waypoint_temp = tpo_convert_ll(lat, lon); // Assign a generic waypoint name - waypoint_name = xmalloc(15); + waypoint_name = (char *) xmalloc(15); sprintf(waypoint_name, "NOTE %d", ii+1); //printf("Waypoint Name: %s\t\t", waypoint_name); waypoint_temp->shortname = waypoint_name; @@ -933,7 +933,7 @@ void tpo_process_map_notes(void) if (name_length) { char *comment; - comment = xmalloc(name_length+1); + comment = (char *) xmalloc(name_length+1); comment[0] = '\0'; gbfread(comment, 1, name_length, tpo_file_in); comment[name_length] = '\0'; // Terminator @@ -953,7 +953,7 @@ void tpo_process_map_notes(void) if (name_length) { char *notes; - notes = xmalloc(name_length+1); + notes = (char *) xmalloc(name_length+1); notes[0] = '\0'; gbfread(notes, 1, name_length, tpo_file_in); notes[name_length] = '\0'; // Terminator @@ -968,7 +968,7 @@ void tpo_process_map_notes(void) if (name_length) { char *notes; - notes = xmalloc(name_length+1); + notes = (char *) xmalloc(name_length+1); notes[0] = '\0'; gbfread(notes, 1, name_length, tpo_file_in); notes[name_length] = '\0'; // Terminator @@ -1050,7 +1050,7 @@ void tpo_process_symbols(void) waypoint_temp = tpo_convert_ll(lat, lon); // Assign a generic waypoint name - waypoint_name = xmalloc(15); + waypoint_name = (char *) xmalloc(15); sprintf(waypoint_name, "SYM %d", ii+1); //printf("Waypoint Name: %s\n", waypoint_name); waypoint_temp->shortname = waypoint_name; @@ -1116,7 +1116,7 @@ void tpo_process_text_labels(void) waypoint_temp = tpo_convert_ll(lat, lon); // Assign a generic waypoint name - waypoint_name = xmalloc(15); + waypoint_name = (char *) xmalloc(15); sprintf(waypoint_name, "TXT %d", ii+1); //printf("Waypoint Name: %s\t\t", waypoint_name); waypoint_temp->shortname = waypoint_name; @@ -1132,7 +1132,7 @@ void tpo_process_text_labels(void) if (name_length) { char *comment; - comment = xmalloc(name_length+1); + comment = (char *) xmalloc(name_length+1); comment[0] = '\0'; gbfread(comment, 1, name_length, tpo_file_in); comment[name_length] = '\0'; // Terminator @@ -1207,12 +1207,12 @@ void tpo_process_routes(void) // Fetch name length name_length = tpo_read_int(); if (name_length) { - route_name = xmalloc(name_length+1); + route_name = (char *) xmalloc(name_length+1); route_name[0] = '\0'; gbfread(route_name, 1, name_length, tpo_file_in); route_name[name_length] = '\0'; // Terminator } else { // Assign a generic route name - route_name = xmalloc(15); + route_name = (char *) xmalloc(15); sprintf(route_name, "RTE %d", ii+1); } route_temp->rte_name = route_name; @@ -1830,7 +1830,7 @@ tpo_write(void) ff_vecs_t tpo2_vecs = { ff_type_file, /* ff_type_internal */ /* { ff_cap_none | ff_cap_none, ff_cap_read | ff_cap_write, ff_cap_none | ff_cap_none }, */ - { ff_cap_none | ff_cap_none, ff_cap_read, ff_cap_none | ff_cap_none }, + { ff_cap_none, ff_cap_read, ff_cap_none }, tpo_rd_init, tpo_wr_init, tpo_rd_deinit, diff --git a/gpsbabel/vidaone.c b/gpsbabel/vidaone.c index 472cd1938..1d1c0a713 100644 --- a/gpsbabel/vidaone.c +++ b/gpsbabel/vidaone.c @@ -136,7 +136,7 @@ ff_vecs_t vidaone_vecs = { ff_type_file, { ff_cap_none /* waypoints */, - ff_cap_read | ff_cap_write /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, ff_cap_none /* routes */ }, vidaone_rd_init, diff --git a/gpsbabel/vitosmt.c b/gpsbabel/vitosmt.c index d2d3bcdd3..045cd9190 100644 --- a/gpsbabel/vitosmt.c +++ b/gpsbabel/vitosmt.c @@ -49,7 +49,7 @@ ReadRecord(gbfile *f, gbsize_t size) static void WriteDouble(void* ptr, double d) { - unsigned char result[8]="\0\0\0\0\0\0\0\0"; + unsigned char result[9]="\0\0\0\0\0\0\0\0"; le_write_double(result,d); memcpy(ptr, result, 8); } @@ -169,7 +169,7 @@ vitosmt_read(void) wpt_tmp->creation_time = mkgmtime(&tmStruct); wpt_tmp->microseconds = fmod(1000000*seconds+0.5,1000000); - wpt_tmp->shortname =xcalloc(16,1); + wpt_tmp->shortname = (char*) xcalloc(16,1); snprintf(wpt_tmp->shortname, 15 , "WP%04d", ++serial); WAYPT_SET(wpt_tmp, speed, KNOTS_TO_MPS(speed)); /* meters per second */ @@ -244,7 +244,7 @@ vitosmt_waypt_pr(const waypoint *waypointp) double seconds =0; ++count; - workbuffer = xcalloc(vitosmt_datasize,1); + workbuffer = (unsigned char *) xcalloc(vitosmt_datasize,1); WriteDouble(&workbuffer[position], RAD(waypointp->latitude)); position += sizeof(double); @@ -324,7 +324,7 @@ vitosmt_write(void) unsigned char * workbuffer =0; size_t position =0; - workbuffer = xcalloc(vitosmt_headersize,1); + workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1); now = current_time(); count = 0; diff --git a/gpsbabel/wbt-200.c b/gpsbabel/wbt-200.c index 849dc2aa7..763bbde88 100644 --- a/gpsbabel/wbt-200.c +++ b/gpsbabel/wbt-200.c @@ -124,7 +124,7 @@ struct buf_head { }; struct read_state { - route_head *route_head; + route_head *route_head_; unsigned wpn, tpn; struct buf_head data; @@ -453,7 +453,7 @@ static int starts_with(const char *buf, const char *pat) */ static int do_cmd(const char *cmd, const char *expect, char *buf, int len) { - int try; + int trycount; rd_drain(); wr_cmdl(cmd); @@ -464,15 +464,15 @@ static int do_cmd(const char *cmd, const char *expect, char *buf, int len) * NMEA data all the time so it's highly likely that it'll be in the * middle of an NMEA sentence when we start listening. */ - for (try = 0; try < RETRIES; try++) { - rd_line(buf, len); - db(3, "Got: %s\n", buf); - if (starts_with(buf, expect)) { - db(2, "Matched: %s\n", buf); - return strlen(expect); - } - db(2, "Skip %d: %s\n", try, buf); - } + for (trycount = 0; trycount < RETRIES; trycount++) { + rd_line(buf, len); + db(3, "Got: %s\n", buf); + if (starts_with(buf, expect)) { + db(2, "Matched: %s\n", buf); + return strlen(expect); + } + db(2, "Skip %d: %s\n", trycount, buf); + } fatal(MYNAME ": Bad response from unit\n"); return 0; /* keep compiler quiet */ @@ -572,7 +572,7 @@ static int wbt200_data_chunk(struct read_state *st, const void *buf, int fmt) double lat, lon, alt; time_t rtim; waypoint *tpt = NULL; - const char *bp = buf; + const char *bp = (const char*) buf; size_t buf_used = fmt_version[fmt].reclen; tim = le_read32(bp + 0); @@ -592,23 +592,23 @@ static int wbt200_data_chunk(struct read_state *st, const void *buf, int fmt) if (lat >= 100) { /* Start new track in the northern hemisphere */ lat -= 100; - st->route_head = NULL; + st->route_head_ = NULL; } else if (lat <= -100) { /* Start new track in the southern hemisphere */ /* This fix courtesy of Anton Frolich */ lat += 100; - st->route_head = NULL; + st->route_head_ = NULL; } tpt = make_trackpoint(st, lat, lon, alt, rtim); - if (NULL == st->route_head) { + if (NULL == st->route_head_) { db(1, "New Track\n"); - st->route_head = route_head_alloc(); - track_add_head(st->route_head); + st->route_head_ = route_head_alloc(); + track_add_head(st->route_head_); } - track_add_wpt(st->route_head, tpt); + track_add_wpt(st->route_head_, tpt); return 1; } @@ -671,7 +671,7 @@ static void wbt200_process_data(struct read_state *pst, int fmt) static void state_init(struct read_state *pst) { - pst->route_head = NULL; + pst->route_head_ = NULL; pst->wpn = 0; pst->tpn = 0; @@ -790,7 +790,7 @@ static void wbt200_data_read(void) static int all_null(const void *buf, const int len) { - const char *bp = buf; + const char *bp = (const char *) buf; int i; for (i = 0; i < len; i++) { @@ -809,7 +809,7 @@ static int wbt201_data_chunk(struct read_state *st, const void *buf) double lat, lon, alt; time_t rtim; waypoint *tpt = NULL; - const char *bp = buf; + const char *bp = (const char *) buf; /* Zero records are skipped */ if (all_null(buf, RECLEN_WBT201)) { @@ -837,18 +837,18 @@ static int wbt201_data_chunk(struct read_state *st, const void *buf) if (global_opts.masked_objective & TRKDATAMASK) { if (flags & WBT201_TRACK_START) { - st->route_head = NULL; + st->route_head_ = NULL; } tpt = make_trackpoint(st, lat, lon, alt, rtim); - if (NULL == st->route_head) { + if (NULL == st->route_head_) { db(1, "New Track\n"); - st->route_head = route_head_alloc(); - track_add_head(st->route_head); + st->route_head_ = route_head_alloc(); + track_add_head(st->route_head_); } - track_add_wpt(st->route_head, tpt); + track_add_wpt(st->route_head_, tpt); } return 1; diff --git a/gpsbabel/wfff_xml.c b/gpsbabel/wfff_xml.c index 8105f3828..1379f0e6c 100644 --- a/gpsbabel/wfff_xml.c +++ b/gpsbabel/wfff_xml.c @@ -93,7 +93,7 @@ xg_tag_mapping loc_map[] = { { wfff_hdop, cb_cdata, "/DocumentElement/AP/HDOP" }, { wfff_lat, cb_cdata, "/DocumentElement/AP/Lat" }, { wfff_lon, cb_cdata, "/DocumentElement/AP/Lon" }, - { 0,0,0 } + { 0,(xg_cb_type)0,0 } }; /* work variables for wfff_xxx */ diff --git a/gpsbabel/xmlgeneric.h b/gpsbabel/xmlgeneric.h index 22d82e535..3a7fca824 100644 --- a/gpsbabel/xmlgeneric.h +++ b/gpsbabel/xmlgeneric.h @@ -27,39 +27,39 @@ typedef enum { cb_end, } xg_cb_type; -typedef void (xg_callback)(const char *, const char **); +typedef void (xg_callback)(const char*, const char**); typedef struct xg_tag_mapping { - xg_callback *tag_cb; + xg_callback* tag_cb; xg_cb_type cb_type; - const char *tag_name; + const char* tag_name; } xg_tag_mapping; -extern char *xhtml_entities; +extern char* xhtml_entities; -void write_xml_entity(gbfile *ofd, const char *indent, - const char *tag, const char *value); -void write_xml_entity_begin0(gbfile *ofd, const char *indent, - const char *tag); -void write_xml_entity_begin1(gbfile *ofd, const char *indent, const char *tag, - const char *attr1, const char *attrval1); -void write_xml_entity_begin2(gbfile *ofd, const char *indent, const char *tag, - const char *attr1, const char *attrval1, - const char *attr2, const char *attrval2); -void write_xml_entity_end(gbfile *ofd, const char *indent, const char *tag); +void write_xml_entity(gbfile* ofd, const char* indent, + const char* tag, const char* value); +void write_xml_entity_begin0(gbfile* ofd, const char* indent, + const char* tag); +void write_xml_entity_begin1(gbfile* ofd, const char* indent, const char* tag, + const char* attr1, const char* attrval1); +void write_xml_entity_begin2(gbfile* ofd, const char* indent, const char* tag, + const char* attr1, const char* attrval1, + const char* attr2, const char* attrval2); +void write_xml_entity_end(gbfile* ofd, const char* indent, const char* tag); -void write_optional_xml_entity(gbfile *ofd, const char *indent, - const char *tag, const char *value); -void xml_write_time(gbfile *ofd, const time_t timep, int microseconds, const char *elname); -void xml_fill_in_time(char *time_string, const time_t timep, int microseconds, +void write_optional_xml_entity(gbfile* ofd, const char* indent, + const char* tag, const char* value); +void xml_write_time(gbfile* ofd, const time_t timep, int microseconds, const char* elname); +void xml_fill_in_time(char* time_string, const time_t timep, int microseconds, int long_or_short); -void write_xml_header(gbfile *ofd); -void xml_ignore_tags(const char **taglist); +void write_xml_header(gbfile* ofd); +void xml_ignore_tags(const char** taglist); -void xml_init(const char *fname, xg_tag_mapping *tbl,const char *encoding); -void xml_init_offset(const char *fname, xg_tag_mapping *tbl, - const char *encoding, gbsize_t offset); +void xml_init(const char* fname, xg_tag_mapping* tbl,const char* encoding); +void xml_init_offset(const char* fname, xg_tag_mapping* tbl, + const char* encoding, gbsize_t offset); void xml_read(void); -void xml_readstring(char *str); -void xml_readprefixstring(char *str); +void xml_readstring(char* str); +void xml_readprefixstring(char* str); void xml_deinit(void); diff --git a/gpsbabel/xol.c b/gpsbabel/xol.c index d03c87b1c..874c803ce 100644 --- a/gpsbabel/xol.c +++ b/gpsbabel/xol.c @@ -63,7 +63,7 @@ xg_tag_mapping xol_map[] = { { xol_shape, cb_start, XOL "/shapes/*shape" }, { xol_shape_end, cb_end, XOL "/shapes/*shape" }, { xol_waypt, cb_start, XOL "/shapes/shape/*points/point" }, - { NULL, 0, NULL } + { NULL, (xg_cb_type)0, NULL } }; @@ -360,8 +360,8 @@ xol_write(void) ff_vecs_t xol_vecs = { ff_type_file, { - ff_cap_read | ff_cap_write, /* waypoints */ - ff_cap_read | ff_cap_write, /* tracks */ + (ff_cap)(ff_cap_read | ff_cap_write), /* waypoints */ + (ff_cap)(ff_cap_read | ff_cap_write), /* tracks */ ff_cap_none }, /* routes */ xol_rd_init, diff --git a/gpsbabel/yahoo.c b/gpsbabel/yahoo.c index 914bff595..e55e00a6f 100644 --- a/gpsbabel/yahoo.c +++ b/gpsbabel/yahoo.c @@ -50,7 +50,7 @@ static xg_tag_mapping gl_map[] = { { wpt_addr, cb_cdata, "/ResultSet/Result/Zip" }, { wpt_addr, cb_cdata, "/ResultSet/Result/Country" }, { wpt_e, cb_end, "/ResultSet/Result" }, - { NULL, 0, NULL} + { NULL, (xg_cb_type)0, NULL} }; static void -- 2.30.2